USB: serial: remove bogus disconnect test in cleanup
authorJohan Hovold <jhovold@gmail.com>
Thu, 21 Mar 2013 11:36:38 +0000 (12:36 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 25 Mar 2013 20:44:18 +0000 (13:44 -0700)
Remove bogus (and unnecessary) test for serial->dev being NULL in
cleanup.

The device is never cleared, and cleanup is never called after a
completed disconnect anyway.

Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/serial/generic.c

index 927c5d6a255e9c456beddcba820dc3d8d49ba882..131d6cbeefee220ba0b8efd4b6c4a09dbfbf06d1 100644 (file)
@@ -104,24 +104,20 @@ EXPORT_SYMBOL_GPL(usb_serial_generic_open);
 
 static void generic_cleanup(struct usb_serial_port *port)
 {
-       struct usb_serial *serial = port->serial;
        unsigned long flags;
        int i;
 
-       if (serial->dev) {
-               /* shutdown any bulk transfers that might be going on */
-               if (port->bulk_out_size) {
-                       for (i = 0; i < ARRAY_SIZE(port->write_urbs); ++i)
-                               usb_kill_urb(port->write_urbs[i]);
+       if (port->bulk_out_size) {
+               for (i = 0; i < ARRAY_SIZE(port->write_urbs); ++i)
+                       usb_kill_urb(port->write_urbs[i]);
 
-                       spin_lock_irqsave(&port->lock, flags);
-                       kfifo_reset_out(&port->write_fifo);
-                       spin_unlock_irqrestore(&port->lock, flags);
-               }
-               if (port->bulk_in_size) {
-                       for (i = 0; i < ARRAY_SIZE(port->read_urbs); ++i)
-                               usb_kill_urb(port->read_urbs[i]);
-               }
+               spin_lock_irqsave(&port->lock, flags);
+               kfifo_reset_out(&port->write_fifo);
+               spin_unlock_irqrestore(&port->lock, flags);
+       }
+       if (port->bulk_in_size) {
+               for (i = 0; i < ARRAY_SIZE(port->read_urbs); ++i)
+                       usb_kill_urb(port->read_urbs[i]);
        }
 }