Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 23198fda authored by Alan Cox's avatar Alan Cox Committed by Linus Torvalds
Browse files

tty: fix chars_in_buffers



This function does not have an error return and returning an error is
instead interpreted as having a lot of pending bytes.

Reported by Jeff Harris who provided a list of some of the remaining
offenders.

Signed-off-by: default avatarAlan Cox <alan@linux.intel.com>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 25470256
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -552,7 +552,7 @@ static int hvc_chars_in_buffer(struct tty_struct *tty)
	struct hvc_struct *hp = tty->driver_data;

	if (!hp)
		return -1;
		return 0;
	return hp->n_outbuf;
}

+1 −3
Original line number Diff line number Diff line
@@ -1866,16 +1866,14 @@ static s32 ntty_chars_in_buffer(struct tty_struct *tty)
{
	struct port *port = tty->driver_data;
	struct nozomi *dc = get_dc_by_tty(tty);
	s32 rval;
	s32 rval = 0;

	if (unlikely(!dc || !port)) {
		rval = -ENODEV;
		goto exit_in_buffer;
	}

	if (unlikely(!port->port.count)) {
		dev_err(&dc->pdev->dev, "No tty open?\n");
		rval = -ENODEV;
		goto exit_in_buffer;
	}

+2 −2
Original line number Diff line number Diff line
@@ -320,10 +320,10 @@ static int ipw_chars_in_buffer(struct tty_struct *linux_tty)
	struct ipw_tty *tty = linux_tty->driver_data;

	if (!tty)
		return -ENODEV;
		return 0;

	if (!tty->open_count)
		return -EINVAL;
		return 0;

	return tty->tx_bytes_queued;
}
+2 −0
Original line number Diff line number Diff line
@@ -408,6 +408,8 @@ static int if_write_room(struct tty_struct *tty)
	return retval;
}

/* FIXME: This function does not have error returns */

static int if_chars_in_buffer(struct tty_struct *tty)
{
	struct cardstate *cs;
+1 −1
Original line number Diff line number Diff line
@@ -750,7 +750,7 @@ static int acm_tty_chars_in_buffer(struct tty_struct *tty)
{
	struct acm *acm = tty->driver_data;
	if (!ACM_READY(acm))
		return -EINVAL;
		return 0;
	/*
	 * This is inaccurate (overcounts), but it works.
	 */
Loading