linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ARM: at91: pm: Add of_node_put() before goto
@ 2021-10-14  8:45 Wan Jiabing
  2021-12-08 13:00 ` Nicolas Ferre
  0 siblings, 1 reply; 2+ messages in thread
From: Wan Jiabing @ 2021-10-14  8:45 UTC (permalink / raw)
  To: Russell King, Nicolas Ferre, Alexandre Belloni,
	Ludovic Desroches, linux-arm-kernel, linux-kernel
  Cc: kael_w, Wan Jiabing

Fix following coccicheck warning:
./arch/arm/mach-at91/pm.c:643:1-33: WARNING: Function
for_each_matching_node_and_match should have of_node_put() before goto

Early exits from for_each_matching_node_and_match should decrement the
node reference counter.

Signed-off-by: Wan Jiabing <wanjiabing@vivo.com>
---
 arch/arm/mach-at91/pm.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c
index 8711d6824c1f..dd6f4ce3f766 100644
--- a/arch/arm/mach-at91/pm.c
+++ b/arch/arm/mach-at91/pm.c
@@ -645,6 +645,7 @@ static __init int at91_dt_ramc(bool phy_mandatory)
 		if (!soc_pm.data.ramc[idx]) {
 			pr_err("unable to map ramc[%d] cpu registers\n", idx);
 			ret = -ENOMEM;
+			of_node_put(np);
 			goto unmap_ramc;
 		}
 
@@ -670,6 +671,7 @@ static __init int at91_dt_ramc(bool phy_mandatory)
 		if (!soc_pm.data.ramc_phy) {
 			pr_err("unable to map ramc phy cpu registers\n");
 			ret = -ENOMEM;
+			of_node_put(np);
 			goto unmap_ramc;
 		}
 	}
-- 
2.20.1


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

* Re: [PATCH] ARM: at91: pm: Add of_node_put() before goto
  2021-10-14  8:45 [PATCH] ARM: at91: pm: Add of_node_put() before goto Wan Jiabing
@ 2021-12-08 13:00 ` Nicolas Ferre
  0 siblings, 0 replies; 2+ messages in thread
From: Nicolas Ferre @ 2021-12-08 13:00 UTC (permalink / raw)
  To: Wan Jiabing, Alexandre Belloni, Ludovic Desroches
  Cc: kael_w, Russell King, linux-kernel, linux-arm-kernel

On 14/10/2021 at 10:45, Wan Jiabing wrote:
> Fix following coccicheck warning:
> ./arch/arm/mach-at91/pm.c:643:1-33: WARNING: Function
> for_each_matching_node_and_match should have of_node_put() before goto
> 
> Early exits from for_each_matching_node_and_match should decrement the
> node reference counter.
> 
> Signed-off-by: Wan Jiabing <wanjiabing@vivo.com>

Even if I think it doesn't happen after a new SoC DT is in place 
properly, I'm fine with this:
Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>

Thanks, best regards,
   Nicolas

> ---
>   arch/arm/mach-at91/pm.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c
> index 8711d6824c1f..dd6f4ce3f766 100644
> --- a/arch/arm/mach-at91/pm.c
> +++ b/arch/arm/mach-at91/pm.c
> @@ -645,6 +645,7 @@ static __init int at91_dt_ramc(bool phy_mandatory)
>                  if (!soc_pm.data.ramc[idx]) {
>                          pr_err("unable to map ramc[%d] cpu registers\n", idx);
>                          ret = -ENOMEM;
> +                       of_node_put(np);
>                          goto unmap_ramc;
>                  }
> 
> @@ -670,6 +671,7 @@ static __init int at91_dt_ramc(bool phy_mandatory)
>                  if (!soc_pm.data.ramc_phy) {
>                          pr_err("unable to map ramc phy cpu registers\n");
>                          ret = -ENOMEM;
> +                       of_node_put(np);
>                          goto unmap_ramc;
>                  }
>          }
> --
> 2.20.1
> 


-- 
Nicolas Ferre

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

end of thread, other threads:[~2021-12-08 13:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-14  8:45 [PATCH] ARM: at91: pm: Add of_node_put() before goto Wan Jiabing
2021-12-08 13:00 ` Nicolas Ferre

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).