USB: driver.c: processing failure, maching resume condition with suspend condition
authorChen Gang <gang.chen@asianux.com>
Mon, 1 Apr 2013 05:04:08 +0000 (13:04 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 1 Apr 2013 19:32:43 +0000 (12:32 -0700)
  when suspend, it need check 'udev->actconfig'.
  so when process failure, also need check it.

Signed-off-by: Chen Gang <gang.chen@asianux.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/core/driver.c

index 84d2b05858102c926fd93f98aa7d8347927f3c09..6eab440e1542e450f7733fb4cbbf35b1b1044313 100644 (file)
@@ -1253,10 +1253,12 @@ static int usb_suspend_both(struct usb_device *udev, pm_message_t msg)
 
        /* If the suspend failed, resume interfaces that did get suspended */
        if (status != 0) {
-               msg.event ^= (PM_EVENT_SUSPEND | PM_EVENT_RESUME);
-               while (++i < n) {
-                       intf = udev->actconfig->interface[i];
-                       usb_resume_interface(udev, intf, msg, 0);
+               if (udev->actconfig) {
+                       msg.event ^= (PM_EVENT_SUSPEND | PM_EVENT_RESUME);
+                       while (++i < n) {
+                               intf = udev->actconfig->interface[i];
+                               usb_resume_interface(udev, intf, msg, 0);
+                       }
                }
 
        /* If the suspend succeeded then prevent any more URB submissions