[PATCH] arm: mach-at91: add missing of_node_put

Subsystems: arm port, arm/microchip (at91) soc support, the rest

STALE1694d

2 messages, 2 authors, 2021-12-13 · open the first message on its own page

[PATCH] arm: mach-at91: add missing of_node_put

From: Qing Wang <hidden>
Date: 2021-12-13 09:46:41

From: Wang Qing <redacted>

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 <redacted>
---
 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


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

Re: [PATCH] arm: mach-at91: add missing of_node_put

From: Nicolas Ferre <nicolas.ferre@microchip.com>
Date: 2021-12-13 13:34:54

On 13/12/2021 at 10:41, Qing Wang wrote:
From: Wang Qing <redacted>

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 <redacted>
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
quoted hunk
---
  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

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help