mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] powerpc/pseries: Fix missing of_node_put
@ 2017-02-06 21:36 Christophe JAILLET
  2017-02-06 23:05 ` Tyrel Datwyler
  0 siblings, 1 reply; 2+ messages in thread
From: Christophe JAILLET @ 2017-02-06 21:36 UTC (permalink / raw)
  To: benh, paulus, mpe, nfont, jallen
  Cc: linuxppc-dev, linux-kernel, kernel-janitors, Christophe JAILLET

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] powerpc/pseries: Fix missing of_node_put
  2017-02-06 21:36 [PATCH] powerpc/pseries: Fix missing of_node_put Christophe JAILLET
@ 2017-02-06 23:05 ` Tyrel Datwyler
  0 siblings, 0 replies; 2+ messages in thread
From: Tyrel Datwyler @ 2017-02-06 23:05 UTC (permalink / raw)
  To: Christophe JAILLET, benh, paulus, mpe, nfont, jallen
  Cc: kernel-janitors, linuxppc-dev, linux-kernel

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;
>  }
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-02-06 23:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-06 21:36 [PATCH] powerpc/pseries: Fix missing of_node_put Christophe JAILLET
2017-02-06 23:05 ` Tyrel Datwyler

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®