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-Url: https://git.stricted.de/?a=commitdiff_plain;h=972d17c9dbad378da61baa17f4c3ea6e154b186a;p=GitHub%2FLineageOS%2Fandroid_kernel_samsung_universal7580.git [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 6f32bebd8a9..cc9632c7149 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); }