Commit 8f44d827 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

[PATCH] USB: fix oops when trying to suspend and resume.

Thanks to Pavel for the original version of this patch.
parent 7140df08
...@@ -1424,14 +1424,15 @@ static int usb_device_suspend(struct device *dev, u32 state) ...@@ -1424,14 +1424,15 @@ static int usb_device_suspend(struct device *dev, u32 state)
struct usb_interface *intf; struct usb_interface *intf;
struct usb_driver *driver; struct usb_driver *driver;
if ((dev->driver == &usb_generic_driver) || if ((dev->driver == NULL) ||
(dev->driver == &usb_generic_driver) ||
(dev->driver_data == &usb_generic_driver_data)) (dev->driver_data == &usb_generic_driver_data))
return 0; return 0;
intf = to_usb_interface(dev); intf = to_usb_interface(dev);
driver = to_usb_driver(dev->driver); driver = to_usb_driver(dev->driver);
if (driver && driver->suspend) if (driver->suspend)
return driver->suspend(intf, state); return driver->suspend(intf, state);
return 0; return 0;
} }
...@@ -1441,14 +1442,15 @@ static int usb_device_resume(struct device *dev) ...@@ -1441,14 +1442,15 @@ static int usb_device_resume(struct device *dev)
struct usb_interface *intf; struct usb_interface *intf;
struct usb_driver *driver; struct usb_driver *driver;
if ((dev->driver == &usb_generic_driver) || if ((dev->driver == NULL) ||
(dev->driver == &usb_generic_driver) ||
(dev->driver_data == &usb_generic_driver_data)) (dev->driver_data == &usb_generic_driver_data))
return 0; return 0;
intf = to_usb_interface(dev); intf = to_usb_interface(dev);
driver = to_usb_driver(dev->driver); driver = to_usb_driver(dev->driver);
if (driver && driver->resume) if (driver->resume)
return driver->resume(intf); return driver->resume(intf);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment