]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
USB: ssu100: fix overrun-error reporting
authorJohan Hovold <johan@kernel.org>
Tue, 18 Nov 2014 10:25:21 +0000 (11:25 +0100)
committerZefan Li <lizefan@huawei.com>
Tue, 14 Apr 2015 09:33:36 +0000 (17:33 +0800)
commit 75bcbf29c284dd0154c3e895a0bd1ef0e796160e upstream.

Fix reporting of overrun errors, which should only be reported once
using the inserted null character.

Fixes: 6b8f1ca5581b ("USB: ssu100: set tty_flags in ssu100_process_packet")
Signed-off-by: Johan Hovold <johan@kernel.org>
[lizf: Backported to 3.4:
 - adjust context
 - lookup tty using tty_port_tty_get()]
Signed-off-by: Zefan Li <lizefan@huawei.com>
drivers/usb/serial/ssu100.c

index d19fa6a9d24785439ed792f02ca726dcfd067e50..f425507d999a2c60cc1708cd4ab64f8d693c02ef 100644 (file)
@@ -598,10 +598,10 @@ static void ssu100_update_lsr(struct usb_serial_port *port, u8 lsr,
                        if (*tty_flag == TTY_NORMAL)
                                *tty_flag = TTY_FRAME;
                }
-               if (lsr & UART_LSR_OE){
+               if (lsr & UART_LSR_OE) {
                        priv->icount.overrun++;
-                       if (*tty_flag == TTY_NORMAL)
-                               *tty_flag = TTY_OVERRUN;
+                       tty_insert_flip_char(tty_port_tty_get(&port->port),
+                                       0, TTY_OVERRUN);
                }
        }
 
@@ -622,11 +622,8 @@ static int ssu100_process_packet(struct urb *urb,
        if ((len >= 4) &&
            (packet[0] == 0x1b) && (packet[1] == 0x1b) &&
            ((packet[2] == 0x00) || (packet[2] == 0x01))) {
-               if (packet[2] == 0x00) {
+               if (packet[2] == 0x00)
                        ssu100_update_lsr(port, packet[3], &flag);
-                       if (flag == TTY_OVERRUN)
-                               tty_insert_flip_char(tty, 0, TTY_OVERRUN);
-               }
                if (packet[2] == 0x01)
                        ssu100_update_msr(port, packet[3]);