All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] soc: bcm: brcmstb: pm: pm-arm: Fix refcount leak in brcmstb_pm_probe
@ 2022-05-26  7:53 ` Miaoqian Lin
  0 siblings, 0 replies; 6+ messages in thread
From: Miaoqian Lin @ 2022-05-26  7:53 UTC (permalink / raw)
  To: Florian Fainelli, Broadcom Kernel Team, Andrew Morton,
	Thomas Bogendoerfer, Kees Cook, Helge Deller, Bjorn Andersson,
	Andy Shevchenko, Miaoqian Lin, Gareth Powell, Brian Norris,
	Doug Berger, Justin Chen, linux-arm-kernel, linux-kernel

of_find_matching_node() returns a node pointer with refcount
incremented, we should use of_node_put() on it when not need anymore.
Add missing of_node_put() to avoid refcount leak.

In brcmstb_init_sram, it pass dn to of_address_to_resource(),
of_address_to_resource() will call of_find_device_by_node() to take
reference, so we should release the reference returned by
of_find_matching_node().

Fixes: 0b741b8234c8 ("soc: bcm: brcmstb: Add support for S2/S3/S5 suspend states (ARM)")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
---
 drivers/soc/bcm/brcmstb/pm/pm-arm.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/soc/bcm/brcmstb/pm/pm-arm.c b/drivers/soc/bcm/brcmstb/pm/pm-arm.c
index 3cbb165d6e30..70ad0f3dce28 100644
--- a/drivers/soc/bcm/brcmstb/pm/pm-arm.c
+++ b/drivers/soc/bcm/brcmstb/pm/pm-arm.c
@@ -783,6 +783,7 @@ static int brcmstb_pm_probe(struct platform_device *pdev)
 	}
 
 	ret = brcmstb_init_sram(dn);
+	of_node_put(dn);
 	if (ret) {
 		pr_err("error setting up SRAM for PM\n");
 		return ret;
-- 
2.25.1


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

end of thread, other threads:[~2022-06-08  9:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-26  7:53 [PATCH] soc: bcm: brcmstb: pm: pm-arm: Fix refcount leak in brcmstb_pm_probe Miaoqian Lin
2022-05-26  7:53 ` Miaoqian Lin
2022-05-26 11:21 ` Andy Shevchenko
2022-05-26 11:21   ` Andy Shevchenko
2022-06-08  9:21 ` Florian Fainelli
2022-06-08  9:21   ` Florian Fainelli

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.