Skip to content

Commit

Permalink
powerpc/pseries: Do all node initialization in dlpar_parse_cc_node
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Tyrel Datwyler authored and ozbenh committed Aug 27, 2013
1 parent c8f5a57 commit 1578cb7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions arch/powerpc/platforms/pseries/dlpar.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 1578cb7

Please sign in to comment.