]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
staging: speakup: check for null before calling TTY's flush_buffer
authorOkash Khawaja <okash.khawaja@gmail.com>
Wed, 31 May 2017 19:50:12 +0000 (20:50 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 3 Jun 2017 08:38:25 +0000 (17:38 +0900)
We should check the flush_buffer method of a tty for null before
invoking it. Some drivers such as usbserial don't implement
flush_buffer. This will be required for upcoming patches where we expand
spk_ttyio to support more than just ttyS*.

Signed-off-by: Okash Khawaja <okash.khawaja@gmail.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/speakup/spk_ttyio.c

index ed36240cf3829aab14055d793ed52a538dfc8552..7b1eaf976f52ba51caaebb4d66336b61cd9d6070 100644 (file)
@@ -227,7 +227,8 @@ static unsigned char spk_ttyio_in_nowait(void)
 
 static void spk_ttyio_flush_buffer(void)
 {
-       speakup_tty->ops->flush_buffer(speakup_tty);
+       if (speakup_tty->ops->flush_buffer)
+               speakup_tty->ops->flush_buffer(speakup_tty);
 }
 
 int spk_ttyio_synth_probe(struct spk_synth *synth)