diff options
author | Liang He <windhl@126.com> | 2022-07-08 11:49:00 +0300 |
---|---|---|
committer | Stephen Boyd <sboyd@kernel.org> | 2022-08-20 00:50:24 +0300 |
commit | 37c381b812dcbfde9c3f1f3d3e75fdfc1b40d5bc (patch) | |
tree | da6db710eea7c6ad39895eeb2aad25e6602d2ca1 /drivers/clk/berlin/bg2.c | |
parent | b3ff02c5df4712b565b290c6f268a79a72a28e74 (diff) | |
download | linux-37c381b812dcbfde9c3f1f3d3e75fdfc1b40d5bc.tar.xz |
clk: berlin: Add of_node_put() for of_get_parent()
In berlin2_clock_setup() and berlin2q_clock_setup(), we need to
call of_node_put() for the reference returned by of_get_parent()
which has increased the refcount. We should call *_put() in fail
path or when it is not used anymore.
Fixes: 26b3b6b959b2 ("clk: berlin: prepare simple-mfd conversion")
Signed-off-by: Liang He <windhl@126.com>
Link: https://lore.kernel.org/r/20220708084900.311684-1-windhl@126.com
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
Diffstat (limited to 'drivers/clk/berlin/bg2.c')
-rw-r--r-- | drivers/clk/berlin/bg2.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/clk/berlin/bg2.c b/drivers/clk/berlin/bg2.c index bccdfa00fd37..67a9edbba29c 100644 --- a/drivers/clk/berlin/bg2.c +++ b/drivers/clk/berlin/bg2.c @@ -500,12 +500,15 @@ static void __init berlin2_clock_setup(struct device_node *np) int n, ret; clk_data = kzalloc(struct_size(clk_data, hws, MAX_CLKS), GFP_KERNEL); - if (!clk_data) + if (!clk_data) { + of_node_put(parent_np); return; + } clk_data->num = MAX_CLKS; hws = clk_data->hws; gbase = of_iomap(parent_np, 0); + of_node_put(parent_np); if (!gbase) return; |