public inbox for linux-rockchip@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH 3/4] ARM: rockchip: fix a leaked reference by adding missing of_node_put
       [not found] <1551785577-45896-1-git-send-email-wen.yang99@zte.com.cn>
@ 2019-03-05 11:32 ` Wen Yang
  2019-04-23 17:54   ` Heiko Stuebner
  0 siblings, 1 reply; 2+ messages in thread
From: Wen Yang @ 2019-03-05 11:32 UTC (permalink / raw)
  To: linux-kernel
  Cc: wang.yi59, Wen Yang, Russell King, Heiko Stuebner,
	linux-arm-kernel, linux-rockchip

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-rockchip/platsmp.c:250:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 241, but without a corresponding object release within this function.
./arch/arm/mach-rockchip/platsmp.c:260:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 241, but without a corresponding object release within this function.
./arch/arm/mach-rockchip/platsmp.c:263:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 241, but without a corresponding object release within this function.

Signed-off-by: Wen Yang <wen.yang99@zte.com.cn>
Cc: Russell King <linux@armlinux.org.uk>
Cc: Heiko Stuebner <heiko@sntech.de>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-rockchip@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
 arch/arm/mach-rockchip/platsmp.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/mach-rockchip/platsmp.c b/arch/arm/mach-rockchip/platsmp.c
index f93d64e..6cb4b21 100644
--- a/arch/arm/mach-rockchip/platsmp.c
+++ b/arch/arm/mach-rockchip/platsmp.c
@@ -245,6 +245,7 @@ static int __init rockchip_smp_prepare_pmu(void)
 	}
 
 	pmu_base = of_iomap(node, 0);
+	of_node_put(node);
 	if (!pmu_base) {
 		pr_err("%s: could not map pmu registers\n", __func__);
 		return -ENOMEM;
-- 
2.9.5

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

* Re: [PATCH 3/4] ARM: rockchip: fix a leaked reference by adding missing of_node_put
  2019-03-05 11:32 ` [PATCH 3/4] ARM: rockchip: fix a leaked reference by adding missing of_node_put Wen Yang
@ 2019-04-23 17:54   ` Heiko Stuebner
  0 siblings, 0 replies; 2+ messages in thread
From: Heiko Stuebner @ 2019-04-23 17:54 UTC (permalink / raw)
  To: Wen Yang
  Cc: linux-kernel, wang.yi59, Russell King, linux-arm-kernel,
	linux-rockchip

Am Dienstag, 5. März 2019, 12:32:56 CEST schrieb Wen Yang:
> 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-rockchip/platsmp.c:250:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 241, but without a corresponding object release within this function.
> ./arch/arm/mach-rockchip/platsmp.c:260:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 241, but without a corresponding object release within this function.
> ./arch/arm/mach-rockchip/platsmp.c:263:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 241, but without a corresponding object release within this function.
> 
> Signed-off-by: Wen Yang <wen.yang99@zte.com.cn>
> Cc: Russell King <linux@armlinux.org.uk>
> Cc: Heiko Stuebner <heiko@sntech.de>
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linux-rockchip@lists.infradead.org
> Cc: linux-kernel@vger.kernel.org

applied for 5.2 after adapting the patch subject a little bit

Thanks
Heiko

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

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

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1551785577-45896-1-git-send-email-wen.yang99@zte.com.cn>
2019-03-05 11:32 ` [PATCH 3/4] ARM: rockchip: fix a leaked reference by adding missing of_node_put Wen Yang
2019-04-23 17:54   ` Heiko Stuebner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox