Patchwork [7/8] powerpc/pseries: add mising of_node_put in delete_dt_node

login
register
mail settings
Submitter Tyrel Datwyler
Date Aug. 15, 2013, 5:23 a.m.
Message ID <1376544232-24936-8-git-send-email-tyreld@linux.vnet.ibm.com>
Download mbox | patch
Permalink /patch/267318/
State Accepted
Commit 14cd820a2a45a1f7b216c6ca9104c91d52564fbf
Headers show

Comments

Tyrel Datwyler - Aug. 15, 2013, 5:23 a.m.
The node to be detached is retrieved via its phandle by a call to
of_find_node_by_phandle which increments the ref count. We need a matching
call to of_node_put to decrement the ref count and ensure the node is
actually freed.

Signed-off-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>
---
 arch/powerpc/platforms/pseries/mobility.c | 1 +
 1 file changed, 1 insertion(+)
Nathan Fontenot - Aug. 19, 2013, 1:54 p.m.
On 08/15/2013 12:23 AM, Tyrel Datwyler wrote:
> The node to be detached is retrieved via its phandle by a call to
> of_find_node_by_phandle which increments the ref count. We need a matching
> call to of_node_put to decrement the ref count and ensure the node is
> actually freed.
> 
> Signed-off-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>

Acked-by: Nathan Fontenot <nfont@linux.vnet.ibm.com>

> ---
>  arch/powerpc/platforms/pseries/mobility.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/arch/powerpc/platforms/pseries/mobility.c b/arch/powerpc/platforms/pseries/mobility.c
> index ff102e2..cde4e0a 100644
> --- a/arch/powerpc/platforms/pseries/mobility.c
> +++ b/arch/powerpc/platforms/pseries/mobility.c
> @@ -62,6 +62,7 @@ static int delete_dt_node(u32 phandle)
>  		return -ENOENT;
>  
>  	dlpar_detach_node(dn);
> +	of_node_put(dn);
>  	return 0;
>  }
>  
>

Patch

diff --git a/arch/powerpc/platforms/pseries/mobility.c b/arch/powerpc/platforms/pseries/mobility.c
index ff102e2..cde4e0a 100644
--- a/arch/powerpc/platforms/pseries/mobility.c
+++ b/arch/powerpc/platforms/pseries/mobility.c
@@ -62,6 +62,7 @@  static int delete_dt_node(u32 phandle)
 		return -ENOENT;
 
 	dlpar_detach_node(dn);
+	of_node_put(dn);
 	return 0;
 }