[PATCH] driver core: Make sure device detached from driver before deleting it
From: Jeffy Chen
Date: Wed Oct 18 2017 - 01:49:50 EST
There are cases we call device_del() without detaching it from the
driver(e.g. spi core del children devices).
Signed-off-by: Jeffy Chen <jeffy.chen@xxxxxxxxxxxxxx>
---
drivers/base/core.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/base/core.c b/drivers/base/core.c
index 12ebd055724c..717efc3020af 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -1951,6 +1951,8 @@ void device_del(struct device *dev)
struct kobject *glue_dir = NULL;
struct class_interface *class_intf;
+ device_release_driver(dev);
+
/* Notify clients of device removal. This call must come
* before dpm_sysfs_remove().
*/
--
2.11.0