Commit cdca2b1c authored by Patrick Mochel's avatar Patrick Mochel

driver model: use list_for_each_safe() when removing devices from a driver.

Duh: in driver_detach(), one of the first things we do is remove the device
from the driver's list of devices. So, we obviously cannot use ->next. 
parent 7b97a9fd
...@@ -174,8 +174,8 @@ static void device_detach(struct device * dev) ...@@ -174,8 +174,8 @@ static void device_detach(struct device * dev)
static void driver_detach(struct device_driver * drv) static void driver_detach(struct device_driver * drv)
{ {
struct list_head * entry; struct list_head * entry, * next;
list_for_each(entry,&drv->devices) { list_for_each_safe(entry,next,&drv->devices) {
struct device * dev = container_of(entry,struct device,driver_list); struct device * dev = container_of(entry,struct device,driver_list);
if (get_device(dev)) { if (get_device(dev)) {
detach(dev,drv); detach(dev,drv);
......
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