diff options
Diffstat (limited to 'drivers/base/bus.c')
-rw-r--r-- | drivers/base/bus.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/base/bus.c b/drivers/base/bus.c index 24eb07868344..519865b53f76 100644 --- a/drivers/base/bus.c +++ b/drivers/base/bus.c | |||
@@ -290,7 +290,7 @@ int bus_for_each_dev(struct bus_type *bus, struct device *start, | |||
290 | struct device *dev; | 290 | struct device *dev; |
291 | int error = 0; | 291 | int error = 0; |
292 | 292 | ||
293 | if (!bus) | 293 | if (!bus || !bus->p) |
294 | return -EINVAL; | 294 | return -EINVAL; |
295 | 295 | ||
296 | klist_iter_init_node(&bus->p->klist_devices, &i, | 296 | klist_iter_init_node(&bus->p->klist_devices, &i, |
@@ -324,7 +324,7 @@ struct device *bus_find_device(struct bus_type *bus, | |||
324 | struct klist_iter i; | 324 | struct klist_iter i; |
325 | struct device *dev; | 325 | struct device *dev; |
326 | 326 | ||
327 | if (!bus) | 327 | if (!bus || !bus->p) |
328 | return NULL; | 328 | return NULL; |
329 | 329 | ||
330 | klist_iter_init_node(&bus->p->klist_devices, &i, | 330 | klist_iter_init_node(&bus->p->klist_devices, &i, |
@@ -700,12 +700,12 @@ int bus_add_driver(struct device_driver *drv) | |||
700 | if (error) | 700 | if (error) |
701 | goto out_unregister; | 701 | goto out_unregister; |
702 | 702 | ||
703 | klist_add_tail(&priv->knode_bus, &bus->p->klist_drivers); | ||
703 | if (drv->bus->p->drivers_autoprobe) { | 704 | if (drv->bus->p->drivers_autoprobe) { |
704 | error = driver_attach(drv); | 705 | error = driver_attach(drv); |
705 | if (error) | 706 | if (error) |
706 | goto out_unregister; | 707 | goto out_unregister; |
707 | } | 708 | } |
708 | klist_add_tail(&priv->knode_bus, &bus->p->klist_drivers); | ||
709 | module_add_driver(drv->owner, drv); | 709 | module_add_driver(drv->owner, drv); |
710 | 710 | ||
711 | error = driver_create_file(drv, &driver_attr_uevent); | 711 | error = driver_create_file(drv, &driver_attr_uevent); |