linux-clk.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] clk: ti: fix refcount leak in ti_dt_clocks_register()
@ 2018-12-26 13:21 Yangtao Li
  2018-12-28 19:27 ` Stephen Boyd
  0 siblings, 1 reply; 2+ messages in thread
From: Yangtao Li @ 2018-12-26 13:21 UTC (permalink / raw)
  To: t-kristo, mturquette, sboyd
  Cc: linux-omap, linux-clk, linux-kernel, Yangtao Li

The of_find_compatible_node() returns a node pointer with refcount
incremented, but there is the lack of use of the of_node_put() when
done. Add the missing of_node_put() to release the refcount.

Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
---
 drivers/clk/ti/clk.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/ti/clk.c b/drivers/clk/ti/clk.c
index d0cd58534781..6c640838cdaa 100644
--- a/drivers/clk/ti/clk.c
+++ b/drivers/clk/ti/clk.c
@@ -191,9 +191,13 @@ void __init ti_dt_clocks_register(struct ti_dt_clk oclks[])
 			clkdev_add(&c->lk);
 		} else {
 			if (num_args && !has_clkctrl_data) {
-				if (of_find_compatible_node(NULL, NULL,
-							    "ti,clkctrl")) {
+				struct device_node *np;
+
+				np = of_find_compatible_node(NULL, NULL,
+					       		     "ti,clkctrl");	
+				if (np) {
 					has_clkctrl_data = true;
+					of_node_put(np);
 				} else {
 					clkctrl_nodes_missing = true;
 
-- 
2.17.0


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

* Re: [PATCH] clk: ti: fix refcount leak in ti_dt_clocks_register()
  2018-12-26 13:21 [PATCH] clk: ti: fix refcount leak in ti_dt_clocks_register() Yangtao Li
@ 2018-12-28 19:27 ` Stephen Boyd
  0 siblings, 0 replies; 2+ messages in thread
From: Stephen Boyd @ 2018-12-28 19:27 UTC (permalink / raw)
  To: Yangtao Li, mturquette, t-kristo
  Cc: linux-omap, linux-clk, linux-kernel, Yangtao Li

Quoting Yangtao Li (2018-12-26 05:21:31)
> The of_find_compatible_node() returns a node pointer with refcount
> incremented, but there is the lack of use of the of_node_put() when
> done. Add the missing of_node_put() to release the refcount.
> 
> Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
> ---
>  drivers/clk/ti/clk.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 

Applied to clk-next and fixed a whine

drivers/clk/ti/clk.c:197: trailing whitespace, space before tab in indent.

please be more careful next time. Also, please add fixes tags to fixes.


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

end of thread, other threads:[~2018-12-28 19:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-26 13:21 [PATCH] clk: ti: fix refcount leak in ti_dt_clocks_register() Yangtao Li
2018-12-28 19:27 ` 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).