Skip to contentSkip to conversation

arm: mach-at91: add missing of_node_put

PATCH In review Qing Wang 2 participants 2 messages Dec 13, 2021

Subsystems (3)
lore
Share & tools
lore

Qing Wang

author
#0 lore raw

PATCH 1/1 arm: mach-at91: add missing of_node_put

From: Wang Qing <[email protected]>

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.

---
 arch/arm/mach-at91/pm.c | 2 ++
 1 file changed, 2 insertions(+)
arch/arm/mach-at91/pm.c +2 -0
index 8711d68..ca313fe
@@ -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;
 		}
Signature · 1 line
2.7.4
maintainer
#1 lore raw
Quoted 10 lines · Qing Wang

From: Wang Qing <[email protected]>

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.

Wang,

What's the difference between this patch and the one accepted here:
https://lore.kernel.org/all/[email protected]/

Regards,
Nicolas

Quoted 27 lines
---
  arch/arm/mach-at91/pm.c | 2 ++
  1 file changed, 2 insertions(+)
arch/arm/mach-at91/pm.c +2 -1
index 8711d68..ca313fe
@@ -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

Signature · 1 line
Nicolas Ferre