Commit 11742252 authored by Samuel Thibault's avatar Samuel Thibault Committed by Greg Kroah-Hartman

speakup: Simplify spk_ttyio_out error handling.

This avoids most code indentation
Signed-off-by: default avatarSamuel Thibault <samuel.thibault@ens-lyon.org>
Link: https://lore.kernel.org/r/20210126222147.3848175-4-samuel.thibault@ens-lyon.orgSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 4f2a81f3
......@@ -225,14 +225,21 @@ void spk_ttyio_unregister_ldisc(void)
static int spk_ttyio_out(struct spk_synth *in_synth, const char ch)
{
struct tty_struct *tty = in_synth->dev;
int ret;
if (!in_synth->alive || !tty->ops->write)
return 0;
if (in_synth->alive && tty->ops->write) {
int ret = tty->ops->write(tty, &ch, 1);
ret = tty->ops->write(tty, &ch, 1);
if (ret == 0)
/* No room */
return 0;
if (ret < 0) {
if (ret > 0)
/* Success */
return 1;
pr_warn("%s: I/O error, deactivating speakup\n",
in_synth->long_name);
/* No synth any more, so nobody will restart TTYs,
......@@ -241,11 +248,6 @@ static int spk_ttyio_out(struct spk_synth *in_synth, const char ch)
*/
in_synth->alive = 0;
speakup_start_ttys();
return 0;
}
return 1;
}
return 0;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment