linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] Check for the root node in of_detach_node()
@ 2007-06-19  6:07 Michael Ellerman
  2007-06-19  6:07 ` [PATCH 2/3] Generalise device_node flag interface Michael Ellerman
  2007-06-19  6:08 ` [PATCH 3/3] Add a warning to help trackdown device_node refcounting bugs Michael Ellerman
  0 siblings, 2 replies; 3+ messages in thread
From: Michael Ellerman @ 2007-06-19  6:07 UTC (permalink / raw)
  To: linuxppc-dev

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>
---
 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 af42dda..6ea94cf 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);
 }
 
-- 
1.5.1.3.g7a33b

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-06-19  6:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-19  6:07 [PATCH 1/3] Check for the root node in of_detach_node() Michael Ellerman
2007-06-19  6:07 ` [PATCH 2/3] Generalise device_node flag interface Michael Ellerman
2007-06-19  6:08 ` [PATCH 3/3] Add a warning to help trackdown device_node refcounting bugs Michael Ellerman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).