aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Cox <alan@linux.intel.com>2009-07-20 11:05:27 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-07-20 19:38:43 -0400
commit23198fda7182969b619613a555f8645fdc3dc334 (patch)
treed6c322a36d955958ab89ffb0a1a7327dc84e180c
parent254702568da63ce6f5ad68e77d83b427da693654 (diff)
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: Alan Cox <alan@linux.intel.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--drivers/char/hvc_console.c2
-rw-r--r--drivers/char/nozomi.c4
-rw-r--r--drivers/char/pcmcia/ipwireless/tty.c4
-rw-r--r--drivers/isdn/gigaset/interface.c2
-rw-r--r--drivers/usb/class/cdc-acm.c2
-rw-r--r--drivers/usb/serial/mos7720.c2
-rw-r--r--drivers/usb/serial/ti_usb_3410_5052.c4
7 files changed, 10 insertions, 10 deletions
diff --git a/drivers/char/hvc_console.c b/drivers/char/hvc_console.c
index 94e7e3c8c05a..d97779ef72cb 100644
--- a/drivers/char/hvc_console.c
+++ b/drivers/char/hvc_console.c
@@ -552,7 +552,7 @@ static int hvc_chars_in_buffer(struct tty_struct *tty)
552 struct hvc_struct *hp = tty->driver_data; 552 struct hvc_struct *hp = tty->driver_data;
553 553
554 if (!hp) 554 if (!hp)
555 return -1; 555 return 0;
556 return hp->n_outbuf; 556 return hp->n_outbuf;
557} 557}
558 558
diff --git a/drivers/char/nozomi.c b/drivers/char/nozomi.c
index 280b41c507a7..ec58d8c387ff 100644
--- a/drivers/char/nozomi.c
+++ b/drivers/char/nozomi.c
@@ -1866,16 +1866,14 @@ static s32 ntty_chars_in_buffer(struct tty_struct *tty)
1866{ 1866{
1867 struct port *port = tty->driver_data; 1867 struct port *port = tty->driver_data;
1868 struct nozomi *dc = get_dc_by_tty(tty); 1868 struct nozomi *dc = get_dc_by_tty(tty);
1869 s32 rval; 1869 s32 rval = 0;
1870 1870
1871 if (unlikely(!dc || !port)) { 1871 if (unlikely(!dc || !port)) {
1872 rval = -ENODEV;
1873 goto exit_in_buffer; 1872 goto exit_in_buffer;
1874 } 1873 }
1875 1874
1876 if (unlikely(!port->port.count)) { 1875 if (unlikely(!port->port.count)) {
1877 dev_err(&dc->pdev->dev, "No tty open?\n"); 1876 dev_err(&dc->pdev->dev, "No tty open?\n");
1878 rval = -ENODEV;
1879 goto exit_in_buffer; 1877 goto exit_in_buffer;
1880 } 1878 }
1881 1879
diff --git a/drivers/char/pcmcia/ipwireless/tty.c b/drivers/char/pcmcia/ipwireless/tty.c
index 569f2f7743a7..674b3ab3587d 100644
--- a/drivers/char/pcmcia/ipwireless/tty.c
+++ b/drivers/char/pcmcia/ipwireless/tty.c
@@ -320,10 +320,10 @@ static int ipw_chars_in_buffer(struct tty_struct *linux_tty)
320 struct ipw_tty *tty = linux_tty->driver_data; 320 struct ipw_tty *tty = linux_tty->driver_data;
321 321
322 if (!tty) 322 if (!tty)
323 return -ENODEV; 323 return 0;
324 324
325 if (!tty->open_count) 325 if (!tty->open_count)
326 return -EINVAL; 326 return 0;
327 327
328 return tty->tx_bytes_queued; 328 return tty->tx_bytes_queued;
329} 329}
diff --git a/drivers/isdn/gigaset/interface.c b/drivers/isdn/gigaset/interface.c
index 1ebfcab74662..8ff7e35c7069 100644
--- a/drivers/isdn/gigaset/interface.c
+++ b/drivers/isdn/gigaset/interface.c
@@ -408,6 +408,8 @@ static int if_write_room(struct tty_struct *tty)
408 return retval; 408 return retval;
409} 409}
410 410
411/* FIXME: This function does not have error returns */
412
411static int if_chars_in_buffer(struct tty_struct *tty) 413static int if_chars_in_buffer(struct tty_struct *tty)
412{ 414{
413 struct cardstate *cs; 415 struct cardstate *cs;
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
index 5b15d9d8896b..e1f89416ef8c 100644
--- a/drivers/usb/class/cdc-acm.c
+++ b/drivers/usb/class/cdc-acm.c
@@ -750,7 +750,7 @@ static int acm_tty_chars_in_buffer(struct tty_struct *tty)
750{ 750{
751 struct acm *acm = tty->driver_data; 751 struct acm *acm = tty->driver_data;
752 if (!ACM_READY(acm)) 752 if (!ACM_READY(acm))
753 return -EINVAL; 753 return 0;
754 /* 754 /*
755 * This is inaccurate (overcounts), but it works. 755 * This is inaccurate (overcounts), but it works.
756 */ 756 */
diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c
index bfc5ce000ef9..ccd4dd340d2c 100644
--- a/drivers/usb/serial/mos7720.c
+++ b/drivers/usb/serial/mos7720.c
@@ -521,7 +521,7 @@ static int mos7720_chars_in_buffer(struct tty_struct *tty)
521 mos7720_port = usb_get_serial_port_data(port); 521 mos7720_port = usb_get_serial_port_data(port);
522 if (mos7720_port == NULL) { 522 if (mos7720_port == NULL) {
523 dbg("%s:leaving ...........", __func__); 523 dbg("%s:leaving ...........", __func__);
524 return -ENODEV; 524 return 0;
525 } 525 }
526 526
527 for (i = 0; i < NUM_URBS; ++i) { 527 for (i = 0; i < NUM_URBS; ++i) {
diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c
index 14971a926990..3bc609fe2242 100644
--- a/drivers/usb/serial/ti_usb_3410_5052.c
+++ b/drivers/usb/serial/ti_usb_3410_5052.c
@@ -727,7 +727,7 @@ static int ti_write_room(struct tty_struct *tty)
727 dbg("%s - port %d", __func__, port->number); 727 dbg("%s - port %d", __func__, port->number);
728 728
729 if (tport == NULL) 729 if (tport == NULL)
730 return -ENODEV; 730 return 0;
731 731
732 spin_lock_irqsave(&tport->tp_lock, flags); 732 spin_lock_irqsave(&tport->tp_lock, flags);
733 room = ti_buf_space_avail(tport->tp_write_buf); 733 room = ti_buf_space_avail(tport->tp_write_buf);
@@ -748,7 +748,7 @@ static int ti_chars_in_buffer(struct tty_struct *tty)
748 dbg("%s - port %d", __func__, port->number); 748 dbg("%s - port %d", __func__, port->number);
749 749
750 if (tport == NULL) 750 if (tport == NULL)
751 return -ENODEV; 751 return 0;
752 752
753 spin_lock_irqsave(&tport->tp_lock, flags); 753 spin_lock_irqsave(&tport->tp_lock, flags);
754 chars = ti_buf_data_avail(tport->tp_write_buf); 754 chars = ti_buf_data_avail(tport->tp_write_buf);