All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] ARM: brcmstb: fix a leaked reference by adding missing of_node_put
@ 2019-03-05 11:32 ` Wen Yang
  0 siblings, 0 replies; 16+ messages in thread
From: Wen Yang @ 2019-03-05 11:32 UTC (permalink / raw)
  To: linux-kernel
  Cc: wang.yi59, Wen Yang, Florian Fainelli, Ray Jui, Scott Branden,
	bcm-kernel-feedback-list, Russell King, Brian Norris,
	Gregory Fong, linux-arm-kernel

The call to of_get_next_child returns a node pointer with refcount
incremented thus it must be explicitly decremented after the last
usage.

Detected by coccinelle with the following warnings:
./arch/arm/mach-bcm/platsmp-brcmstb.c:337:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 329, but without a corresponding object release within this function.
./arch/arm/mach-bcm/platsmp-brcmstb.c:341:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 329, but without a corresponding object release within this functio
./arch/arm/mach-bcm/bcm63xx_smp.c:150:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 130, but without a corresponding object release within this function.

Signed-off-by: Wen Yang <wen.yang99@zte.com.cn>
Cc: Florian Fainelli <f.fainelli@gmail.com>
Cc: Ray Jui <rjui@broadcom.com>
Cc: Scott Branden <sbranden@broadcom.com>
Cc: bcm-kernel-feedback-list@broadcom.com
Cc: Russell King <linux@armlinux.org.uk>
Cc: Brian Norris <computersforpeace@gmail.com>
Cc: Gregory Fong <gregory.0xf0@gmail.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
 arch/arm/mach-bcm/bcm63xx_smp.c     | 1 +
 arch/arm/mach-bcm/platsmp-brcmstb.c | 7 +++++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-bcm/bcm63xx_smp.c b/arch/arm/mach-bcm/bcm63xx_smp.c
index f5fb10b..1cb4ce8 100644
--- a/arch/arm/mach-bcm/bcm63xx_smp.c
+++ b/arch/arm/mach-bcm/bcm63xx_smp.c
@@ -142,6 +142,7 @@ static int bcm63138_smp_boot_secondary(unsigned int cpu,
 	 * return
 	 */
 	ret = bcm63xx_pmb_power_on_cpu(dn);
+	of_node_put(dn);
 	if (ret)
 		goto out;
 out:
diff --git a/arch/arm/mach-bcm/platsmp-brcmstb.c b/arch/arm/mach-bcm/platsmp-brcmstb.c
index 1237996..4555f21 100644
--- a/arch/arm/mach-bcm/platsmp-brcmstb.c
+++ b/arch/arm/mach-bcm/platsmp-brcmstb.c
@@ -334,11 +334,14 @@ static void __init brcmstb_cpu_ctrl_setup(unsigned int max_cpus)
 
 	rc = setup_hifcpubiuctrl_regs(np);
 	if (rc)
-		return;
+		goto out_put_node;
 
 	rc = setup_hifcont_regs(np);
 	if (rc)
-		return;
+		goto out_put_node;
+
+out_put_node:
+	of_node_put(np);
 }
 
 static int brcmstb_boot_secondary(unsigned int cpu, struct task_struct *idle)
-- 
2.9.5


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

end of thread, other threads:[~2019-04-23 17:54 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-05 11:32 [PATCH 1/4] ARM: brcmstb: fix a leaked reference by adding missing of_node_put Wen Yang
2019-03-05 11:32 ` Wen Yang
2019-03-05 11:32 ` [PATCH 2/4] ARM: mvebu: " Wen Yang
2019-03-05 11:32   ` Wen Yang
2019-04-21 17:24   ` Gregory CLEMENT
2019-04-21 17:24     ` Gregory CLEMENT
2019-03-05 11:32 ` [PATCH 3/4] ARM: rockchip: " Wen Yang
2019-03-05 11:32   ` Wen Yang
2019-04-23 17:54   ` Heiko Stuebner
2019-04-23 17:54     ` Heiko Stuebner
2019-03-05 11:32 ` [PATCH 4/4] ARM: sunxi: " Wen Yang
2019-03-05 11:32   ` Wen Yang
2019-03-05 11:59   ` Maxime Ripard
2019-03-05 11:59     ` Maxime Ripard
2019-03-06  3:14 ` [PATCH 1/4] ARM: brcmstb: " Florian Fainelli
2019-03-06  3:14   ` 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.