[PATCH 3.16 005/129] clk: socfpga: fix refcount leak

From: Ben Hutchings
Date: Sun Jul 07 2019 - 15:46:55 EST


3.16.70-rc1 review patch. If anyone has any objections, please let me know.

------------------

From: Yangtao Li <tiny.windzz@xxxxxxxxx>

commit 7f9705beeb3759e69165e7aff588f6488ff6c1ac upstream.

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@xxxxxxxxx>
Fixes: 5343325ff3dd ("clk: socfpga: add a clock driver for the Arria 10 platform")
Fixes: a30d27ed739b ("clk: socfpga: fix clock driver for 3.15")
Signed-off-by: Stephen Boyd <sboyd@xxxxxxxxxx>
[bwh: Backported to 3.16: drop changes in clk-pll-a10.c]
Signed-off-by: Ben Hutchings <ben@xxxxxxxxxxxxxxx>
---
--- a/drivers/clk/socfpga/clk-pll.c
+++ b/drivers/clk/socfpga/clk-pll.c
@@ -102,6 +102,7 @@ static __init struct clk *__socfpga_pll_

clkmgr_np = of_find_compatible_node(NULL, NULL, "altr,clk-mgr");
clk_mgr_base_addr = of_iomap(clkmgr_np, 0);
+ of_node_put(clkmgr_np);
BUG_ON(!clk_mgr_base_addr);
pll_clk->hw.reg = clk_mgr_base_addr + reg;