mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-15 10:18:08 +00:00
[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>
This commit is contained in:
parent
333e615483
commit
972d17c9db
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user