| Message ID | 1376544232-24936-9-git-send-email-tyreld@linux.vnet.ibm.com (mailing list archive) |
|---|---|
| State | Accepted, archived |
| Commit | 5935ff4343a689fbb382d64408bc6955c6589830 |
| Headers | show |
On 08/15/2013 12:23 AM, Tyrel Datwyler wrote: > Calls to dlpar_detach_node do not iterate over child nodes detaching them as > well. By iterating and detaching the child nodes we ensure that they have the > OF_DETACHED flag set and that their reference counts are decremented such that > the node will be freed from memory by of_node_release. > > Signed-off-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com> Acked-by: Nathan Fontenot <nfont@linux.vnet.ibm.com> > --- > arch/powerpc/platforms/pseries/dlpar.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/arch/powerpc/platforms/pseries/dlpar.c b/arch/powerpc/platforms/pseries/dlpar.c > index 4ea667d..7cfdaae 100644 > --- a/arch/powerpc/platforms/pseries/dlpar.c > +++ b/arch/powerpc/platforms/pseries/dlpar.c > @@ -286,8 +286,15 @@ int dlpar_attach_node(struct device_node *dn) > > int dlpar_detach_node(struct device_node *dn) > { > + struct device_node *child; > int rc; > > + child = of_get_next_child(dn, NULL); > + while (child) { > + dlpar_detach_node(child); > + child = of_get_next_child(dn, child); > + } > + > rc = of_detach_node(dn); > if (rc) > return rc; >
diff --git a/arch/powerpc/platforms/pseries/dlpar.c b/arch/powerpc/platforms/pseries/dlpar.c index 4ea667d..7cfdaae 100644 --- a/arch/powerpc/platforms/pseries/dlpar.c +++ b/arch/powerpc/platforms/pseries/dlpar.c @@ -286,8 +286,15 @@ int dlpar_attach_node(struct device_node *dn) int dlpar_detach_node(struct device_node *dn) { + struct device_node *child; int rc; + child = of_get_next_child(dn, NULL); + while (child) { + dlpar_detach_node(child); + child = of_get_next_child(dn, child); + } + rc = of_detach_node(dn); if (rc) return rc;
Calls to dlpar_detach_node do not iterate over child nodes detaching them as well. By iterating and detaching the child nodes we ensure that they have the OF_DETACHED flag set and that their reference counts are decremented such that the node will be freed from memory by of_node_release. Signed-off-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com> --- arch/powerpc/platforms/pseries/dlpar.c | 7 +++++++ 1 file changed, 7 insertions(+)