mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] soc: bcm: brcmstb: Add of_node_put() in pm-mips
@ 2021-10-15  6:49 Wan Jiabing
  2021-10-20 22:56 ` Florian Fainelli
  0 siblings, 1 reply; 2+ messages in thread
From: Wan Jiabing @ 2021-10-15  6:49 UTC (permalink / raw)
  To: Florian Fainelli, bcm-kernel-feedback-list, Wan Jiabing,
	linux-arm-kernel, linux-kernel
  Cc: kael_w

Fix following coccicheck warning:
./drivers/soc/bcm/brcmstb/pm/pm-mips.c:404:1-23: WARNING: Function
for_each_matching_node should have of_node_put() before goto or break

Early exits from for_each_matching_node should decrement the
node reference counter.

Signed-off-by: Wan Jiabing <wanjiabing@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 cdc3e387f049..4dfb5a85032b 100644
--- a/drivers/soc/bcm/brcmstb/pm/pm-mips.c
+++ b/drivers/soc/bcm/brcmstb/pm/pm-mips.c
@@ -405,11 +405,14 @@ static int brcmstb_pm_init(void)
 		i = ctrl.num_memc;
 		if (i >= MAX_NUM_MEMC) {
 			pr_warn("Too many MEMCs (max %d)\n", MAX_NUM_MEMC);
+			of_node_put(dn);
 			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.20.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] soc: bcm: brcmstb: Add of_node_put() in pm-mips
  2021-10-15  6:49 [PATCH] soc: bcm: brcmstb: Add of_node_put() in pm-mips Wan Jiabing
@ 2021-10-20 22:56 ` Florian Fainelli
  0 siblings, 0 replies; 2+ messages in thread
From: Florian Fainelli @ 2021-10-20 22:56 UTC (permalink / raw)
  To: bcm-kernel-feedback-list, Wan Jiabing, linux-arm-kernel, linux-kernel
  Cc: kael_w

On Fri, 15 Oct 2021 02:49:23 -0400, Wan Jiabing <wanjiabing@vivo.com> wrote:
> Fix following coccicheck warning:
> ./drivers/soc/bcm/brcmstb/pm/pm-mips.c:404:1-23: WARNING: Function
> for_each_matching_node should have of_node_put() before goto or break
> 
> Early exits from for_each_matching_node should decrement the
> node reference counter.
> 
> Signed-off-by: Wan Jiabing <wanjiabing@vivo.com>
> ---

Applied to https://github.com/Broadcom/stblinux/commits/drivers/next, thanks!
--
Florian

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-10-20 22:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-15  6:49 [PATCH] soc: bcm: brcmstb: Add of_node_put() in pm-mips Wan Jiabing
2021-10-20 22:56 ` Florian Fainelli

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®