From 972d17c9dbad378da61baa17f4c3ea6e154b186a Mon Sep 17 00:00:00 2001 From: Michael Ellerman Date: Tue, 19 Jun 2007 16:07:56 +1000 Subject: [PATCH] [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 --- arch/powerpc/kernel/prom.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c index 6f32bebd8a9b..cc9632c7149e 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); } -- 2.30.2