Commit 51d30bf5 authored by Patrick Mochel's avatar Patrick Mochel

driver model: Don't reset dev->driver until after we call dev->driver->remove.

This fixes an Oops in the USB code that was using ->driver, both for checking what driver to
use and calling into it. 

From Greg KH.
parent a7ae4eb3
......@@ -97,18 +97,13 @@ static int device_attach(struct device * dev)
static void device_detach(struct device * dev)
{
struct device_driver * drv;
struct device_driver * drv = dev->driver;
if (dev->driver) {
if (drv) {
devclass_remove_device(dev);
spin_lock(&device_lock);
drv = dev->driver;
dev->driver = NULL;
spin_unlock(&device_lock);
/* detach from driver */
if (drv && drv->remove)
drv->remove(dev);
dev->driver = NULL;
}
}
......
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