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

speakup: Simplify spk_ttyio_out error handling.

parent 4f2a81f3
Loading
Loading
Loading
Loading
+20 −18
Original line number Diff line number Diff line
@@ -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,
@@ -243,11 +250,6 @@ static int spk_ttyio_out(struct spk_synth *in_synth, const char ch)
	speakup_start_ttys();
	return 0;
}
		return 1;
	}

	return 0;
}

static int spk_ttyio_out_unicode(struct spk_synth *in_synth, u16 ch)
{