]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
[POWERPC] Check for the root node in of_detach_node()
authorMichael Ellerman <michael@ellerman.id.au>
Tue, 19 Jun 2007 06:07:56 +0000 (16:07 +1000)
committerPaul Mackerras <paulus@samba.org>
Tue, 10 Jul 2007 11:53:45 +0000 (21:53 +1000)
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 <michael@ellerman.id.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
arch/powerpc/kernel/prom.c

index 6f32bebd8a9b6d74deb4b52bf2c6a65f357ee715..cc9632c7149ed3bc5f2c195d598f4a3d5678a906 100644 (file)
@@ -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);
 }