Skip to contentSkip to conversation

drivers: soc: bcm: brcmstb: Add missing of_node_put() in biuctrl.c

PATCH Applied Liang He 2 participants 2 messages Jun 15, 2022 – Jun 17, 2022 Broadcom BCM7XXX Arm architecture

lore
Share & tools
lore

Liang He

author
#0 lore raw

PATCH 1/1 drivers: soc: bcm: brcmstb: Add missing of_node_put() in biuctrl.c

In brcmstb_biuctrl_init(), of_find_compatible_node() will return a node pointer with refcount incremented. We should use of_node_put() in each fail path or when it is not used anymore.

---
 drivers/soc/bcm/brcmstb/biuctrl.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/soc/bcm/brcmstb/biuctrl.c +6 -3
index 2c975d79fe8e..1467bbd59690 100644
@@ -340,12 +340,12 @@ static int __init brcmstb_biuctrl_init(void)
 
 	ret = setup_hifcpubiuctrl_regs(np);
 	if (ret)
-		return ret;
+		goto out_put;
 
 	ret = mcp_write_pairing_set();
 	if (ret) {
 		pr_err("MCP: Unable to disable write pairing!\n");
-		return ret;
+		goto out_put;
 	}
 
 	a72_b53_rac_enable_all(np);
@@ -353,6 +353,9 @@ static int __init brcmstb_biuctrl_init(void)
 #ifdef CONFIG_PM_SLEEP
 	register_syscore_ops(&brcmstb_cpu_credit_syscore_ops);
 #endif
-	return 0;
+	ret = 0;
+out_put:
+	of_node_put(np);
+	return ret;
 }
 early_initcall(brcmstb_biuctrl_init);
Signature · 1 line
2.25.1
#1 lore raw
Quoted 5 lines · Liang He

In brcmstb_biuctrl_init(), of_find_compatible_node() will return a node pointer with refcount incremented. We should use of_node_put() in each fail path or when it is not used anymore.

Applied, thanks!

Signature · 1 line
Florian