Skip to contentSkip to conversation

staging: speakup: check for null before calling TTY's flush_buffer

PATCH New Okash Khawaja 1 participant 1 message May 31, 2017 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: speakup: check for null before calling TTY's flush_buffer

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*.

---
 drivers/staging/speakup/spk_ttyio.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/staging/speakup/spk_ttyio.c +2 -1
@@ -227,7 +227,8 @@ static unsigned char spk_ttyio_in_nowait
 
 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)