Gitweb: http://git.kernel.org/linus/014c90dbb9b63bae067afc80a7931a76c5268ae3 Commit: 014c90dbb9b63bae067afc80a7931a76c5268ae3 Parent: 4ccb457966391295bd9b3644f6bdc9ddd97b6051 Author: Greg Kroah-Hartman <gregkh@suse.de> AuthorDate: Wed Apr 15 16:00:12 2009 -0700 Committer: Greg Kroah-Hartman <gregkh@suse.de> CommitDate: Thu Apr 16 16:17:11 2009 -0700 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> --- drivers/base/core.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/drivers/base/core.c b/drivers/base/core.c index e73c92d..d230ff4 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); -- To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
