Commit 7c3ccad2 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

Driver Model: fix oops when device is removed from system

parent c257aa42
...@@ -103,12 +103,13 @@ static void device_detach(struct device * dev) ...@@ -103,12 +103,13 @@ static void device_detach(struct device * dev)
devclass_remove_device(dev); devclass_remove_device(dev);
spin_lock(&device_lock); spin_lock(&device_lock);
drv = dev->driver; drv = dev->driver;
dev->driver = NULL;
spin_unlock(&device_lock); spin_unlock(&device_lock);
/* detach from driver */ /* detach from driver */
if (drv && drv->remove) if (drv && drv->remove)
drv->remove(dev); 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