aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTyrel Datwyler <tyreld@linux.vnet.ibm.com>2013-08-15 01:23:49 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2013-08-27 00:45:13 -0400
commit1578cb76d46c9735a740c919cb9b7e5d1ba92420 (patch)
treeed504537f69ea8657849f070728e25a631461b5c
parentc8f5a57c62fcf821c435fc657f430a64205f3e99 (diff)
powerpc/pseries: Do all node initialization in dlpar_parse_cc_node
Currently the OF_DYNAMIC and kref initialization for a node happens in dlpar_attach_node. However, a node passed to dlpar_attach_node may be a tree containing child nodes, and no initialization traversal is done on the tree. Since the children never get their kref initialized or the OF_DYNAMIC flag set these nodes are prevented from ever being released from memory should they become detached. This initialization step is better done at the time each node is allocated in dlpar_parse_cc_node. Signed-off-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com> Acked-by: Nathan Fontenot <nfont@linux.vnet.ibm.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
-rw-r--r--arch/powerpc/platforms/pseries/dlpar.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/arch/powerpc/platforms/pseries/dlpar.c b/arch/powerpc/platforms/pseries/dlpar.c
index a1a7b9a67ffd..c85523355779 100644
--- a/arch/powerpc/platforms/pseries/dlpar.c
+++ b/arch/powerpc/platforms/pseries/dlpar.c
@@ -83,6 +83,9 @@ static struct device_node *dlpar_parse_cc_node(struct cc_workarea *ccwa)
83 return NULL; 83 return NULL;
84 } 84 }
85 85
86 of_node_set_flag(dn, OF_DYNAMIC);
87 kref_init(&dn->kref);
88
86 return dn; 89 return dn;
87} 90}
88 91
@@ -256,8 +259,6 @@ int dlpar_attach_node(struct device_node *dn)
256{ 259{
257 int rc; 260 int rc;
258 261
259 of_node_set_flag(dn, OF_DYNAMIC);
260 kref_init(&dn->kref);
261 dn->parent = derive_parent(dn->full_name); 262 dn->parent = derive_parent(dn->full_name);
262 if (!dn->parent) 263 if (!dn->parent)
263 return -ENOMEM; 264 return -ENOMEM;