diff options
Diffstat (limited to 'drivers/base/bus.c')
-rw-r--r-- | drivers/base/bus.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/base/bus.c b/drivers/base/bus.c index f4fa27315fb4..2b3902c867da 100644 --- a/drivers/base/bus.c +++ b/drivers/base/bus.c | |||
@@ -405,9 +405,8 @@ void device_release_driver(struct device * dev) | |||
405 | 405 | ||
406 | static void driver_detach(struct device_driver * drv) | 406 | static void driver_detach(struct device_driver * drv) |
407 | { | 407 | { |
408 | struct list_head * entry, * next; | 408 | while (!list_empty(&drv->devices)) { |
409 | list_for_each_safe(entry, next, &drv->devices) { | 409 | struct device * dev = container_of(drv->devices.next, struct device, driver_list); |
410 | struct device * dev = container_of(entry, struct device, driver_list); | ||
411 | device_release_driver(dev); | 410 | device_release_driver(dev); |
412 | } | 411 | } |
413 | } | 412 | } |