From: Michael Ellerman Date: Tue, 19 Jun 2007 06:07:56 +0000 (+1000) Subject: [POWERPC] Check for the root node in of_detach_node() X-Git-Tag: v2.6.23-rc1~767^2^2~27 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=972d17c9dbad378da61baa17f4c3ea6e154b186a;p=linux-2.6 [POWERPC] Check for the root node in of_detach_node() It's not sensible to call of_detach_node() on the root node, but we should check for it just to be safe. Signed-off-by: Michael Ellerman Signed-off-by: Paul Mackerras --- diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c index 6f32bebd8a..cc9632c714 100644 --- a/arch/powerpc/kernel/prom.c +++ b/arch/powerpc/kernel/prom.c @@ -1432,6 +1432,8 @@ void of_detach_node(const struct device_node *np) write_lock(&devtree_lock); parent = np->parent; + if (!parent) + goto out_unlock; if (allnodes == np) allnodes = np->allnext; @@ -1455,6 +1457,7 @@ void of_detach_node(const struct device_node *np) prevsib->sibling = np->sibling; } +out_unlock: write_unlock(&devtree_lock); }