Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1575159 > unrolled thread

[PATCH] powerpc/pseries: Fix missing of_node_put

Started byChristophe JAILLET <christophe.jaillet@wanadoo.fr>
First post2017-02-06 22:40 +0100
Last post2017-02-07 00:10 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] powerpc/pseries: Fix missing of_node_put Christophe JAILLET <christophe.jaillet@wanadoo.fr> - 2017-02-06 22:40 +0100
    Re: [PATCH] powerpc/pseries: Fix missing of_node_put Tyrel Datwyler <tyreld@linux.vnet.ibm.com> - 2017-02-07 00:10 +0100

#1575159 — [PATCH] powerpc/pseries: Fix missing of_node_put

FromChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Date2017-02-06 22:40 +0100
Subject[PATCH] powerpc/pseries: Fix missing of_node_put
Message-ID<t7ZaV-214-3@gated-at.bofh.it>
If 'dlpar_configure_connector()' fails, 'parent_dn' should be released as
already done in the normal case.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 arch/powerpc/platforms/pseries/mobility.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/platforms/pseries/mobility.c b/arch/powerpc/platforms/pseries/mobility.c
index 5a0c7ba429ce..b8060c182ae2 100644
--- a/arch/powerpc/platforms/pseries/mobility.c
+++ b/arch/powerpc/platforms/pseries/mobility.c
@@ -226,13 +226,16 @@ static int add_dt_node(__be32 parent_phandle, __be32 drc_index)
 		return -ENOENT;
 
 	dn = dlpar_configure_connector(drc_index, parent_dn);
-	if (!dn)
-		return -ENOENT;
+	if (!dn) {
+		rc = -ENOENT;
+		goto out;
+	}
 
 	rc = dlpar_attach_node(dn);
 	if (rc)
 		dlpar_free_cc_nodes(dn);
 
+out:
 	of_node_put(parent_dn);
 	return rc;
 }
-- 
2.9.3

[toc] | [next] | [standalone]


#1575239

FromTyrel Datwyler <tyreld@linux.vnet.ibm.com>
Date2017-02-07 00:10 +0100
Message-ID<t80A1-32r-1@gated-at.bofh.it>
In reply to#1575159
On 02/06/2017 01:36 PM, Christophe JAILLET wrote:
> If 'dlpar_configure_connector()' fails, 'parent_dn' should be released as
> already done in the normal case.
> 
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
>  arch/powerpc/platforms/pseries/mobility.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/powerpc/platforms/pseries/mobility.c b/arch/powerpc/platforms/pseries/mobility.c
> index 5a0c7ba429ce..b8060c182ae2 100644
> --- a/arch/powerpc/platforms/pseries/mobility.c
> +++ b/arch/powerpc/platforms/pseries/mobility.c
> @@ -226,13 +226,16 @@ static int add_dt_node(__be32 parent_phandle, __be32 drc_index)
>  		return -ENOENT;
> 
>  	dn = dlpar_configure_connector(drc_index, parent_dn);

Simpler approach would be to move the of_node_put() call to here
directly after the last use of parent_dn.

-Tyrel

> -	if (!dn)
> -		return -ENOENT;
> +	if (!dn) {
> +		rc = -ENOENT;
> +		goto out;
> +	}
> 
>  	rc = dlpar_attach_node(dn);
>  	if (rc)
>  		dlpar_free_cc_nodes(dn);
> 
> +out:
>  	of_node_put(parent_dn);
>  	return rc;
>  }
> 

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web