linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] clk: versatile: Add of_node_put() in cm_osc_setup()
@ 2019-08-04 16:34 Nishka Dasgupta
  2019-08-06 12:53 ` Linus Walleij
  2019-08-07 22:25 ` Stephen Boyd
  0 siblings, 2 replies; 3+ messages in thread
From: Nishka Dasgupta @ 2019-08-04 16:34 UTC (permalink / raw)
  To: mturquette, sboyd, linux-clk, linus.walleij, linux-arm-kernel
  Cc: Nishka Dasgupta

In function cm_osc_setup, variable parent takes the value returned by
of_get_parent, which gets a node but does not put it. If parent is not
put before it goes out of scope, it may cause a memory leak.
Hence put parent before the function terminates.
Issue found with Coccinelle.

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

diff --git a/drivers/clk/versatile/clk-versatile.c b/drivers/clk/versatile/clk-versatile.c
index 90bb0b041b7a..fd54d5c0251c 100644
--- a/drivers/clk/versatile/clk-versatile.c
+++ b/drivers/clk/versatile/clk-versatile.c
@@ -70,6 +70,7 @@ static void __init cm_osc_setup(struct device_node *np,
 			return;
 		}
 		cm_base = of_iomap(parent, 0);
+		of_node_put(parent);
 		if (!cm_base) {
 			pr_err("could not remap core module base\n");
 			return;
-- 
2.19.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] clk: versatile: Add of_node_put() in cm_osc_setup()
  2019-08-04 16:34 [PATCH] clk: versatile: Add of_node_put() in cm_osc_setup() Nishka Dasgupta
@ 2019-08-06 12:53 ` Linus Walleij
  2019-08-07 22:25 ` Stephen Boyd
  1 sibling, 0 replies; 3+ messages in thread
From: Linus Walleij @ 2019-08-06 12:53 UTC (permalink / raw)
  To: Nishka Dasgupta; +Cc: Stephen Boyd, Michael Turquette, linux-clk, Linux ARM

On Sun, Aug 4, 2019 at 6:34 PM Nishka Dasgupta <nishkadg.linux@gmail.com> wrote:

> In function cm_osc_setup, variable parent takes the value returned by
> of_get_parent, which gets a node but does not put it. If parent is not
> put before it goes out of scope, it may cause a memory leak.
> Hence put parent before the function terminates.
> Issue found with Coccinelle.
>
> Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com>

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] clk: versatile: Add of_node_put() in cm_osc_setup()
  2019-08-04 16:34 [PATCH] clk: versatile: Add of_node_put() in cm_osc_setup() Nishka Dasgupta
  2019-08-06 12:53 ` Linus Walleij
@ 2019-08-07 22:25 ` Stephen Boyd
  1 sibling, 0 replies; 3+ messages in thread
From: Stephen Boyd @ 2019-08-07 22:25 UTC (permalink / raw)
  To: Nishka Dasgupta, linus.walleij, linux-arm-kernel, linux-clk,
	mturquette
  Cc: Nishka Dasgupta

Quoting Nishka Dasgupta (2019-08-04 09:34:44)
> In function cm_osc_setup, variable parent takes the value returned by
> of_get_parent, which gets a node but does not put it. If parent is not
> put before it goes out of scope, it may cause a memory leak.
> Hence put parent before the function terminates.
> Issue found with Coccinelle.
> 
> Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com>
> ---

Applied to clk-next


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2019-08-07 22:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-08-04 16:34 [PATCH] clk: versatile: Add of_node_put() in cm_osc_setup() Nishka Dasgupta
2019-08-06 12:53 ` Linus Walleij
2019-08-07 22:25 ` Stephen Boyd

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).