All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] clk: st: clk-flexgen: Add of_node_put() in st_of_flexgen_setup()
@ 2019-08-04 16:31 Nishka Dasgupta
  2019-08-07 22:34 ` Stephen Boyd
  0 siblings, 1 reply; 2+ messages in thread
From: Nishka Dasgupta @ 2019-08-04 16:31 UTC (permalink / raw)
  To: mturquette, sboyd, linux-clk; +Cc: Nishka Dasgupta

In function st_of_flexgen_setup, variable pnode takes the return value
of of_get_parent, which gets a node but does not put it. If pnode is not
put before the function returns, it may cause a memory leak. Hence put
pnode after its last occurrence.
Issue found with Coccinelle.

Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com>
---
 drivers/clk/st/clk-flexgen.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/clk/st/clk-flexgen.c b/drivers/clk/st/clk-flexgen.c
index d18e49b4976f..4413b6e04a8e 100644
--- a/drivers/clk/st/clk-flexgen.c
+++ b/drivers/clk/st/clk-flexgen.c
@@ -326,6 +326,7 @@ static void __init st_of_flexgen_setup(struct device_node *np)
 		return;
 
 	reg = of_iomap(pnode, 0);
+	of_node_put(pnode);
 	if (!reg)
 		return;
 
-- 
2.19.1


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

* Re: [PATCH] clk: st: clk-flexgen: Add of_node_put() in st_of_flexgen_setup()
  2019-08-04 16:31 [PATCH] clk: st: clk-flexgen: Add of_node_put() in st_of_flexgen_setup() 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, mturquette; +Cc: Nishka Dasgupta

Quoting Nishka Dasgupta (2019-08-04 09:31:51)
> In function st_of_flexgen_setup, variable pnode takes the return value
> of of_get_parent, which gets a node but does not put it. If pnode is not
> put before the function returns, it may cause a memory leak. Hence put
> pnode after its last occurrence.
> 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:31 [PATCH] clk: st: clk-flexgen: Add of_node_put() in st_of_flexgen_setup() 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.