diff options
Diffstat (limited to 'drivers/base')
-rw-r--r-- | drivers/base/bus.c | 5 | ||||
-rw-r--r-- | drivers/base/core.c | 2 |
2 files changed, 3 insertions, 4 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 | } |
diff --git a/drivers/base/core.c b/drivers/base/core.c index a7cedd8cefe5..268a9c8d168b 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c | |||
@@ -139,7 +139,7 @@ static int dev_hotplug(struct kset *kset, struct kobject *kobj, char **envp, | |||
139 | buffer = &buffer[length]; | 139 | buffer = &buffer[length]; |
140 | buffer_size -= length; | 140 | buffer_size -= length; |
141 | 141 | ||
142 | if (dev->bus->hotplug) { | 142 | if (dev->bus && dev->bus->hotplug) { |
143 | /* have the bus specific function add its stuff */ | 143 | /* have the bus specific function add its stuff */ |
144 | retval = dev->bus->hotplug (dev, envp, num_envp, buffer, buffer_size); | 144 | retval = dev->bus->hotplug (dev, envp, num_envp, buffer, buffer_size); |
145 | if (retval) { | 145 | if (retval) { |