mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] arm: mach-at91: add missing of_node_put
@ 2021-12-13  9:41 Qing Wang
  2021-12-13 13:34 ` Nicolas Ferre
  0 siblings, 1 reply; 2+ messages in thread
From: Qing Wang @ 2021-12-13  9:41 UTC (permalink / raw)
  To: Russell King, Nicolas Ferre, Alexandre Belloni,
	Ludovic Desroches, linux-arm-kernel, linux-kernel
  Cc: Wang Qing

From: Wang Qing <wangqing@vivo.com>

Fix following coccicheck warning:
WARNING: Function "for_each_matching_node_and_match" 
should have of_node_put() before return.

Early exits from for_each_matching_node_and_match should decrement the
node reference counter.

Signed-off-by: Wang Qing <wangqing@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 8711d68..ca313fe
--- a/arch/arm/mach-at91/pm.c
+++ b/arch/arm/mach-at91/pm.c
@@ -644,6 +644,7 @@ static __init int at91_dt_ramc(bool phy_mandatory)
 		soc_pm.data.ramc[idx] = of_iomap(np, 0);
 		if (!soc_pm.data.ramc[idx]) {
 			pr_err("unable to map ramc[%d] cpu registers\n", idx);
+			of_node_put(np);
 			ret = -ENOMEM;
 			goto unmap_ramc;
 		}
@@ -669,6 +670,7 @@ static __init int at91_dt_ramc(bool phy_mandatory)
 		soc_pm.data.ramc_phy = of_iomap(np, 0);
 		if (!soc_pm.data.ramc_phy) {
 			pr_err("unable to map ramc phy cpu registers\n");
+			of_node_put(np);
 			ret = -ENOMEM;
 			goto unmap_ramc;
 		}
-- 
2.7.4


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

* Re: [PATCH] arm: mach-at91: add missing of_node_put
  2021-12-13  9:41 [PATCH] arm: mach-at91: add missing of_node_put Qing Wang
@ 2021-12-13 13:34 ` Nicolas Ferre
  0 siblings, 0 replies; 2+ messages in thread
From: Nicolas Ferre @ 2021-12-13 13:34 UTC (permalink / raw)
  To: Qing Wang, Russell King, Alexandre Belloni, Ludovic Desroches,
	linux-arm-kernel, linux-kernel

On 13/12/2021 at 10:41, Qing Wang wrote:
> From: Wang Qing <wangqing@vivo.com>
> 
> Fix following coccicheck warning:
> WARNING: Function "for_each_matching_node_and_match"
> should have of_node_put() before return.
> 
> Early exits from for_each_matching_node_and_match should decrement the
> node reference counter.
> 
> Signed-off-by: Wang Qing <wangqing@vivo.com>

Wang,

What's the difference between this patch and the one accepted here:
https://lore.kernel.org/all/20211014084555.21422-1-wanjiabing@vivo.com/

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 8711d68..ca313fe
> --- a/arch/arm/mach-at91/pm.c
> +++ b/arch/arm/mach-at91/pm.c
> @@ -644,6 +644,7 @@ static __init int at91_dt_ramc(bool phy_mandatory)
>                  soc_pm.data.ramc[idx] = of_iomap(np, 0);
>                  if (!soc_pm.data.ramc[idx]) {
>                          pr_err("unable to map ramc[%d] cpu registers\n", idx);
> +                       of_node_put(np);
>                          ret = -ENOMEM;
>                          goto unmap_ramc;
>                  }
> @@ -669,6 +670,7 @@ static __init int at91_dt_ramc(bool phy_mandatory)
>                  soc_pm.data.ramc_phy = of_iomap(np, 0);
>                  if (!soc_pm.data.ramc_phy) {
>                          pr_err("unable to map ramc phy cpu registers\n");
> +                       of_node_put(np);
>                          ret = -ENOMEM;
>                          goto unmap_ramc;
>                  }
> --
> 2.7.4
> 


-- 
Nicolas Ferre

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

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

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-13  9:41 [PATCH] arm: mach-at91: add missing of_node_put Qing Wang
2021-12-13 13:34 ` Nicolas Ferre

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®