USB: sierra: do not resume I/O on closed ports
authorJohan Hovold <jhovold@gmail.com>
Mon, 26 May 2014 17:23:03 +0000 (19:23 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 27 May 2014 22:04:04 +0000 (15:04 -0700)
Do not resume any I/O, including the delayed write queue, on closed
ports.

Note that this currently has no functional impact due to the
usb_autopm_get_interface() in close(), but that call is about to be
removed by a follow-up patch.

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

index 74b417c91e302707ec97341b4ed6c2e5192b4bab..ac5e20d9bd24bc50f14c5554f45dcf1fe3e87bd3 100644 (file)
@@ -1013,7 +1013,7 @@ static int sierra_resume(struct usb_serial *serial)
                port = serial->port[i];
                portdata = usb_get_serial_port_data(port);
 
-               if (!portdata)
+               if (!portdata || !portdata->opened)
                        continue;
 
                while ((urb = usb_get_from_anchor(&portdata->delayed))) {
@@ -1036,11 +1036,9 @@ static int sierra_resume(struct usb_serial *serial)
                        }
                }
 
-               if (portdata->opened) {
-                       err = sierra_submit_rx_urbs(port, GFP_ATOMIC);
-                       if (err)
-                               ec++;
-               }
+               err = sierra_submit_rx_urbs(port, GFP_ATOMIC);
+               if (err)
+                       ec++;
        }
        intfdata->suspended = 0;
        spin_unlock_irq(&intfdata->susp_lock);