diff options
author | Michael Ellerman <michael@ellerman.id.au> | 2007-06-19 02:07:56 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2007-07-10 07:53:45 -0400 |
commit | 972d17c9dbad378da61baa17f4c3ea6e154b186a (patch) | |
tree | 0e8fb037ceaafbb77a9a66001a4ebeb5ec454217 /arch | |
parent | 333e615483afc5203d1cae1490e50982d6eefbea (diff) |
[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 <michael@ellerman.id.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/powerpc/kernel/prom.c | 3 |
1 files changed, 3 insertions, 0 deletions
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) | |||
1432 | write_lock(&devtree_lock); | 1432 | write_lock(&devtree_lock); |
1433 | 1433 | ||
1434 | parent = np->parent; | 1434 | parent = np->parent; |
1435 | if (!parent) | ||
1436 | goto out_unlock; | ||
1435 | 1437 | ||
1436 | if (allnodes == np) | 1438 | if (allnodes == np) |
1437 | allnodes = np->allnext; | 1439 | allnodes = np->allnext; |
@@ -1455,6 +1457,7 @@ void of_detach_node(const struct device_node *np) | |||
1455 | prevsib->sibling = np->sibling; | 1457 | prevsib->sibling = np->sibling; |
1456 | } | 1458 | } |
1457 | 1459 | ||
1460 | out_unlock: | ||
1458 | write_unlock(&devtree_lock); | 1461 | write_unlock(&devtree_lock); |
1459 | } | 1462 | } |
1460 | 1463 | ||