Discussion:
[patch] staging: speakup: check for null before calling TTY's flush_buffer
Okash Khawaja
2017-05-31 12:55:54 UTC
Permalink
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 <***@gmail.com>

---
drivers/staging/speakup/spk_ttyio.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

--- a/drivers/staging/speakup/spk_ttyio.c
+++ b/drivers/staging/speakup/spk_ttyio.c
@@ -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)
Samuel Thibault
2017-05-31 13:00:25 UTC
Permalink
Post by Okash Khawaja
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(-)
--- a/drivers/staging/speakup/spk_ttyio.c
+++ b/drivers/staging/speakup/spk_ttyio.c
@@ -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)
--
Samuel
Who wants to remember that escape-x-alt-control-left shift-b puts you into
super-edit-debug-compile mode?
(Discussion in comp.os.linux.misc on the intuitiveness of commands, especially
Emacs.)
Okash Khawaja
2017-05-31 19:50:12 UTC
Permalink
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 <***@gmail.com>
Reviewed-by: Samuel Thibault <***@ens-lyon.org>

---
drivers/staging/speakup/spk_ttyio.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

--- a/drivers/staging/speakup/spk_ttyio.c
+++ b/drivers/staging/speakup/spk_ttyio.c
@@ -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)

Loading...