Skip to contentSkip to conversation

soc: dove: add missing of_node_put before break

PATCH New Qing Wang 1 participant 1 message Dec 13, 2021 Arm/Marvell Dove/MV78xx0/Orion SoC support

lore
Share & tools
lore

Qing Wang

author
#0 lore raw

PATCH 1/1 soc: dove: add missing of_node_put before break

From: Wang Qing <[email protected]>

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

Early exits from for_each_available_child_of_node should decrement the node reference counter.

---
 drivers/soc/dove/pmu.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/soc/dove/pmu.c +4 -1
index ffc5311..6202dbc
@@ -410,13 +410,16 @@ int __init dove_init_pmu(void)
 		struct pmu_domain *domain;
 
 		domain = kzalloc(sizeof(*domain), GFP_KERNEL);
-		if (!domain)
+		if (!domain) {
+			of_node_put(np);
 			break;
+		}
 
 		domain->pmu = pmu;
 		domain->base.name = kasprintf(GFP_KERNEL, "%pOFn", np);
 		if (!domain->base.name) {
 			kfree(domain);
+			of_node_put(np);
 			break;
 		}
 
Signature · 7 lines
2.7.4


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel