Driver core: treat unregistered bus_types as having no devices
[pandora-kernel.git] / drivers / base / bus.c
index 000e7b2..8b8e8c0 100644 (file)
@@ -289,7 +289,7 @@ int bus_for_each_dev(struct bus_type *bus, struct device *start,
        struct device *dev;
        int error = 0;
 
-       if (!bus)
+       if (!bus || !bus->p)
                return -EINVAL;
 
        klist_iter_init_node(&bus->p->klist_devices, &i,
@@ -323,7 +323,7 @@ struct device *bus_find_device(struct bus_type *bus,
        struct klist_iter i;
        struct device *dev;
 
-       if (!bus)
+       if (!bus || !bus->p)
                return NULL;
 
        klist_iter_init_node(&bus->p->klist_devices, &i,