* [PATCH] bcm: pm-mips: add missing of_node_put
@ 2021-12-13 9:45 Qing Wang
0 siblings, 0 replies; only message in thread
From: Qing Wang @ 2021-12-13 9:45 UTC (permalink / raw)
To: Florian Fainelli, bcm-kernel-feedback-list, linux-arm-kernel,
linux-kernel
Cc: Wang Qing
From: Wang Qing <wangqing@vivo.com>
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.
Signed-off-by: Wang Qing <wangqing@vivo.com>
---
drivers/soc/bcm/brcmstb/pm/pm-mips.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/soc/bcm/brcmstb/pm/pm-mips.c b/drivers/soc/bcm/brcmstb/pm/pm-mips.c
index cdc3e38..2336e38
--- a/drivers/soc/bcm/brcmstb/pm/pm-mips.c
+++ b/drivers/soc/bcm/brcmstb/pm/pm-mips.c
@@ -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++;
--
2.7.4
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-12-13 9:51 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-13 9:45 [PATCH] bcm: pm-mips: add missing of_node_put Qing Wang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®