diff options
Diffstat (limited to 'drivers/base')
-rw-r--r-- | drivers/base/bus.c | 2 | ||||
-rw-r--r-- | drivers/base/driver.c | 2 |
2 files changed, 4 insertions, 0 deletions
diff --git a/drivers/base/bus.c b/drivers/base/bus.c index 8547b780bb5a..11463c00451e 100644 --- a/drivers/base/bus.c +++ b/drivers/base/bus.c | |||
@@ -932,6 +932,7 @@ bus_uevent_fail: | |||
932 | kset_unregister(&bus->p->subsys); | 932 | kset_unregister(&bus->p->subsys); |
933 | kfree(bus->p); | 933 | kfree(bus->p); |
934 | out: | 934 | out: |
935 | bus->p = NULL; | ||
935 | return retval; | 936 | return retval; |
936 | } | 937 | } |
937 | EXPORT_SYMBOL_GPL(bus_register); | 938 | EXPORT_SYMBOL_GPL(bus_register); |
@@ -953,6 +954,7 @@ void bus_unregister(struct bus_type *bus) | |||
953 | bus_remove_file(bus, &bus_attr_uevent); | 954 | bus_remove_file(bus, &bus_attr_uevent); |
954 | kset_unregister(&bus->p->subsys); | 955 | kset_unregister(&bus->p->subsys); |
955 | kfree(bus->p); | 956 | kfree(bus->p); |
957 | bus->p = NULL; | ||
956 | } | 958 | } |
957 | EXPORT_SYMBOL_GPL(bus_unregister); | 959 | EXPORT_SYMBOL_GPL(bus_unregister); |
958 | 960 | ||
diff --git a/drivers/base/driver.c b/drivers/base/driver.c index 1e2bda780e48..2889ad57e48b 100644 --- a/drivers/base/driver.c +++ b/drivers/base/driver.c | |||
@@ -216,6 +216,8 @@ int driver_register(struct device_driver *drv) | |||
216 | int ret; | 216 | int ret; |
217 | struct device_driver *other; | 217 | struct device_driver *other; |
218 | 218 | ||
219 | BUG_ON(!drv->bus->p); | ||
220 | |||
219 | if ((drv->bus->probe && drv->probe) || | 221 | if ((drv->bus->probe && drv->probe) || |
220 | (drv->bus->remove && drv->remove) || | 222 | (drv->bus->remove && drv->remove) || |
221 | (drv->bus->shutdown && drv->shutdown)) | 223 | (drv->bus->shutdown && drv->shutdown)) |