Commit 84e3e1b0 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

[PATCH] USB: fix oops in usb_hotplug for root devices

parent 59368b68
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
more docs, etc) more docs, etc)
* (C) Copyright Yggdrasil Computing, Inc. 2000 * (C) Copyright Yggdrasil Computing, Inc. 2000
* (usb_device_id matching changes by Adam J. Richter) * (usb_device_id matching changes by Adam J. Richter)
* (C) Copyright Greg Kroah-Hartman 2002 * (C) Copyright Greg Kroah-Hartman 2002-2003
* *
* NOTE! This is not actually a driver at all, rather this is * NOTE! This is not actually a driver at all, rather this is
* just a collection of helper routines that implement the * just a collection of helper routines that implement the
...@@ -76,6 +76,8 @@ static struct device_driver usb_generic_driver = { ...@@ -76,6 +76,8 @@ static struct device_driver usb_generic_driver = {
.remove = generic_remove, .remove = generic_remove,
}; };
static int usb_generic_driver_data;
/* needs to be called with BKL held */ /* needs to be called with BKL held */
int usb_device_probe(struct device *dev) int usb_device_probe(struct device *dev)
{ {
...@@ -535,7 +537,9 @@ static int usb_hotplug (struct device *dev, char **envp, int num_envp, ...@@ -535,7 +537,9 @@ static int usb_hotplug (struct device *dev, char **envp, int num_envp,
if (!dev) if (!dev)
return -ENODEV; return -ENODEV;
if (dev->driver == &usb_generic_driver) /* Must check driver_data here, as on remove driver is always NULL */
if ((dev->driver == &usb_generic_driver) ||
(dev->driver_data == &usb_generic_driver_data))
return 0; return 0;
intf = to_usb_interface(dev); intf = to_usb_interface(dev);
...@@ -994,6 +998,7 @@ int usb_new_device(struct usb_device *dev, struct device *parent) ...@@ -994,6 +998,7 @@ int usb_new_device(struct usb_device *dev, struct device *parent)
dev->dev.driver = &usb_generic_driver; dev->dev.driver = &usb_generic_driver;
dev->dev.bus = &usb_bus_type; dev->dev.bus = &usb_bus_type;
dev->dev.release = usb_release_dev; dev->dev.release = usb_release_dev;
dev->dev.driver_data = &usb_generic_driver_data;
usb_get_dev(dev); usb_get_dev(dev);
if (dev->dev.bus_id[0] == 0) if (dev->dev.bus_id[0] == 0)
sprintf (&dev->dev.bus_id[0], "%d-%s", sprintf (&dev->dev.bus_id[0], "%d-%s",
......
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