summaryrefslogtreecommitdiffstats
path: root/drivers/staging/greybus/core.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/staging/greybus/core.c')
-rw-r--r--drivers/staging/greybus/core.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/staging/greybus/core.c b/drivers/staging/greybus/core.c
index 925e1dc00eff..3b1be2dd2359 100644
--- a/drivers/staging/greybus/core.c
+++ b/drivers/staging/greybus/core.c
@@ -235,6 +235,13 @@ void greybus_remove_hd(struct greybus_host_device *hd)
*/
gb_interfaces_remove(hd);
gb_endo_remove(hd->endo);
+
+ /*
+ * Make sure there are no leftovers that can potentially corrupt sysfs.
+ */
+ if (WARN_ON(!list_empty(&hd->connections)))
+ gb_hd_connections_exit(hd);
+
kref_put_mutex(&hd->kref, free_hd, &hd_mutex);
}
EXPORT_SYMBOL_GPL(greybus_remove_hd);