[PATCH 3.16 013/129] clk: dove: fix refcount leak in dove_clk_init()

From: Ben Hutchings
Date: Sun Jul 07 2019 - 15:47:05 EST


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

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

From: Yangtao Li <tiny.windzz@xxxxxxxxx>

commit 8d726c5128298386b907963033be93407b0c4275 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>
Reviewed-by: Gregory CLEMENT <gregory.clement@xxxxxxxxxxx>
Fixes: 8f7fc5450b64 ("clk: mvebu: dove: maintain clock init order")
Fixes: 63b8d92c793f ("clk: add Dove PLL divider support for GPU, VMeta and AXI clocks")
Signed-off-by: Stephen Boyd <sboyd@xxxxxxxxxx>
[bwh: Backported to 3.16: There is no ddnp variable here]
Signed-off-by: Ben Hutchings <ben@xxxxxxxxxxxxxxx>
---
--- a/drivers/clk/mvebu/dove.c
+++ b/drivers/clk/mvebu/dove.c
@@ -187,7 +187,9 @@ static void __init dove_clk_init(struct

mvebu_coreclk_setup(np, &dove_coreclks);

- if (cgnp)
+ if (cgnp) {
mvebu_clk_gating_setup(cgnp, dove_gating_desc);
+ of_node_put(cgnp);
+ }
}
CLK_OF_DECLARE(dove_clk, "marvell,dove-core-clock", dove_clk_init);