From 1e8eef8eff749ad9ff23f8dcc14081b26b3bcf0c Mon Sep 17 00:00:00 2001 From: Tyrel Datwyler Date: Wed, 14 Aug 2013 22:23:49 -0700 Subject: [PATCH] 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 Acked-by: Nathan Fontenot Signed-off-by: Benjamin Herrenschmidt --- arch/powerpc/platforms/pseries/dlpar.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/platforms/pseries/dlpar.c b/arch/powerpc/platforms/pseries/dlpar.c index a1a7b9a67ffde..c855233557792 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) return NULL; } + of_node_set_flag(dn, OF_DYNAMIC); + kref_init(&dn->kref); + return dn; } @@ -256,8 +259,6 @@ int dlpar_attach_node(struct device_node *dn) { int rc; - of_node_set_flag(dn, OF_DYNAMIC); - kref_init(&dn->kref); dn->parent = derive_parent(dn->full_name); if (!dn->parent) return -ENOMEM; -- 2.39.5