summaryrefslogtreecommitdiff
path: root/drivers/base
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/core.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/base/core.c b/drivers/base/core.c
index e9f7079058d4..977c4b9fe92a 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -103,12 +103,13 @@ static void device_detach(struct device * dev)
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;
}
}