Commit 2bf82952 authored by Nathan Lynch's avatar Nathan Lynch Committed by Linus Torvalds

[PATCH] ppc64: fix use kref for device_node refcounting (fix)

The recent ppc64 patch to use kref for device_node refcounting
introduced an unbalanced get/put in of_add_node which would cause
newly-added device nodes to be prematurely freed.  Sorry for the
screwup, a more rigorously tested fix follows.
Signed-off-by: default avatarNathan Lynch <nathanl@austin.ibm.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent f05de2a3
...@@ -1771,6 +1771,7 @@ int of_add_node(const char *path, struct property *proplist) ...@@ -1771,6 +1771,7 @@ int of_add_node(const char *path, struct property *proplist)
np->properties = proplist; np->properties = proplist;
OF_MARK_DYNAMIC(np); OF_MARK_DYNAMIC(np);
kref_init(&np->kref); kref_init(&np->kref);
of_node_get(np);
np->parent = derive_parent(path); np->parent = derive_parent(path);
if (!np->parent) { if (!np->parent) {
kfree(np); kfree(np);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment