usb_wwan: fix error in marking device busy
authorOliver Neukum <oliver@neukum.org>
Thu, 10 Feb 2011 14:33:10 +0000 (15:33 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 17 Feb 2011 18:51:11 +0000 (10:51 -0800)
This fixes two errors:
- the device is busy if a message was recieved even if resubmission fails
- the device is not busy if resubmission fails due to -EPERM

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/serial/usb_wwan.c

index b004b2a485c38765570193d5e162f8172c9e00a1..7bd06854f87236735f866809f04915cf00b8cfb0 100644 (file)
@@ -305,11 +305,16 @@ static void usb_wwan_indat_callback(struct urb *urb)
                /* Resubmit urb so we continue receiving */
                if (status != -ESHUTDOWN) {
                        err = usb_submit_urb(urb, GFP_ATOMIC);
-                       if (err && err != -EPERM)
-                               printk(KERN_ERR "%s: resubmit read urb failed. "
-                                      "(%d)", __func__, err);
-                       else
+                       if (err) {
+                               if (err != -EPERM) {
+                                       printk(KERN_ERR "%s: resubmit read urb failed. "
+                                               "(%d)", __func__, err);
+                                       /* busy also in error unless we are killed */
+                                       usb_mark_last_busy(port->serial->dev);
+                               }
+                       } else {
                                usb_mark_last_busy(port->serial->dev);
+                       }
                }
 
        }