Skip to contentSkip to conversation

bcm: pm-mips: add missing of_node_put

PATCH New Qing Wang 1 participant 1 message Dec 13, 2021 Broadcom BCM7XXX Arm architecture

lore
Share & tools
lore

Qing Wang

author
#0 lore raw

PATCH 1/1 bcm: pm-mips: add missing of_node_put

From: Wang Qing <[email protected]>

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

Early exits from for_each_matching_node should decrement the node reference counter.

---
 drivers/soc/bcm/brcmstb/pm/pm-mips.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/soc/bcm/brcmstb/pm/pm-mips.c +4 -1
index cdc3e38..2336e38
@@ -404,12 +404,15 @@ static int brcmstb_pm_init(void)
 	for_each_matching_node(dn, ddr_phy_dt_ids) {
 		i = ctrl.num_memc;
 		if (i >= MAX_NUM_MEMC) {
+			of_node_put(dn);
 			pr_warn("Too many MEMCs (max %d)\n", MAX_NUM_MEMC);
 			break;
 		}
 		base = brcmstb_ioremap_node(dn, 0);
-		if (IS_ERR(base))
+		if (IS_ERR(base)) {
+			of_node_put(dn);
 			goto ddr_err;
+		}
 
 		ctrl.memcs[i].ddr_phy_base = base;
 		ctrl.num_memc++;
Signature · 1 line
2.7.4