* [PATCH] clk: ti: dm814x: Add of_node_put() to prevent memory leak
@ 2019-08-04 16:33 Nishka Dasgupta
2019-08-07 22:34 ` Stephen Boyd
0 siblings, 1 reply; 2+ messages in thread
From: Nishka Dasgupta @ 2019-08-04 16:33 UTC (permalink / raw)
To: mturquette, sboyd, linux-clk, t-kristo, linux-omap; +Cc: Nishka Dasgupta
In function dm814x_adpll_early_init, variable np takes the value
returned by of_find_node_by_name, which gets a node but does not put it.
If np is not put before return, it may cause a memory leak. Hence put np
before return.
Issue found with Coccinelle.
Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com>
---
drivers/clk/ti/clk-814x.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/clk/ti/clk-814x.c b/drivers/clk/ti/clk-814x.c
index e8cee6f3b4a0..087cfa75ac24 100644
--- a/drivers/clk/ti/clk-814x.c
+++ b/drivers/clk/ti/clk-814x.c
@@ -66,6 +66,7 @@ static int __init dm814x_adpll_early_init(void)
}
of_platform_populate(np, NULL, NULL, NULL);
+ of_node_put(np);
return 0;
}
--
2.19.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] clk: ti: dm814x: Add of_node_put() to prevent memory leak
2019-08-04 16:33 [PATCH] clk: ti: dm814x: Add of_node_put() to prevent memory leak Nishka Dasgupta
@ 2019-08-07 22:34 ` Stephen Boyd
0 siblings, 0 replies; 2+ messages in thread
From: Stephen Boyd @ 2019-08-07 22:34 UTC (permalink / raw)
To: Nishka Dasgupta, linux-clk, linux-omap, mturquette, t-kristo
Cc: Nishka Dasgupta
Quoting Nishka Dasgupta (2019-08-04 09:33:28)
> In function dm814x_adpll_early_init, variable np takes the value
> returned by of_find_node_by_name, which gets a node but does not put it.
> If np is not put before return, it may cause a memory leak. Hence put np
> before return.
> Issue found with Coccinelle.
>
> Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com>
> ---
Applied to clk-next
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-08-07 22:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-08-04 16:33 [PATCH] clk: ti: dm814x: Add of_node_put() to prevent memory leak Nishka Dasgupta
2019-08-07 22:34 ` Stephen Boyd
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.