USB: visor: fix trivial accounting bug in visor driver
authorOliver Neukum <oliver@neukum.org>
Thu, 1 Oct 2009 12:54:46 +0000 (14:54 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 9 Oct 2009 20:52:08 +0000 (13:52 -0700)
usb:usbserial:visor: fix accounting in error case

data not pushed to the tty layer due to an error mustn't be counted

Signed-off-by: Oliver Neukum <oliver@neukum.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/serial/visor.c

index 1aa5d20..8e2d6dd 100644 (file)
@@ -513,7 +513,8 @@ static void visor_read_bulk_callback(struct urb *urb)
                        tty_kref_put(tty);
                }
                spin_lock(&priv->lock);
-               priv->bytes_in += available_room;
+               if (tty)
+                       priv->bytes_in += available_room;
 
        } else {
                spin_lock(&priv->lock);