Skip to content

Commit

Permalink
[POWERPC] Check for the root node in of_detach_node()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Michael Ellerman authored and Paul Mackerras committed Jul 10, 2007
1 parent 333e615 commit 972d17c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions arch/powerpc/kernel/prom.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -1455,6 +1457,7 @@ void of_detach_node(const struct device_node *np)
prevsib->sibling = np->sibling;
}

out_unlock:
write_unlock(&devtree_lock);
}

Expand Down

0 comments on commit 972d17c

Please sign in to comment.