aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2009-04-15 16:00:12 -0700
committerGreg Kroah-Hartman <gregkh@suse.de>2009-04-16 16:17:11 -0700
commit014c90dbb9b63bae067afc80a7931a76c5268ae3 (patch)
tree0cdea5ea29cc1cee3ec2f03baf7afc3d6a4d45be /drivers/base
parentdynamic debug: resurrect old pr_debug() semantics as pr_devel() (diff)
downloadlinux-dev-014c90dbb9b63bae067afc80a7931a76c5268ae3.tar.xz
linux-dev-014c90dbb9b63bae067afc80a7931a76c5268ae3.zip
driver core: prevent device_for_each_child from oopsing
David Vrabel noticed that the wireless usb stack likes to call device_for_each_chile() with an empty bus. This used to work fine, but now oopses. This patch fixes the oops and makes the code behave like it used to. Reported-by: David Vrabel <david.vrabel@csr.com> Tested-by: David Vrabel <david.vrabel@csr.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/core.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/base/core.c b/drivers/base/core.c
index e73c92d13a23..d230ff4b3eec 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -1142,6 +1142,9 @@ int device_for_each_child(struct device *parent, void *data,
struct device *child;
int error = 0;
+ if (!parent->p)
+ return 0;
+
klist_iter_init(&parent->p->klist_children, &i);
while ((child = next_device(&i)) && !error)
error = fn(child, data);