Commit 2c629dd2 authored by Liang He's avatar Liang He Committed by Arnd Bergmann

arm: mach-spear: Add missing of_node_put() in time.c

In spear_setup_of_timer(), of_find_matching_node() will return a
node pointer with refcount incrementd. We should use of_node_put()
in each fail path or when it is not used anymore.
Signed-off-by: default avatarLiang He <windhl@126.com>
Acked-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
Link: https://lore.kernel.org/r/20220616093027.3984903-1-windhl@126.com'
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
parent 1ba904b6
...@@ -218,13 +218,13 @@ void __init spear_setup_of_timer(void) ...@@ -218,13 +218,13 @@ void __init spear_setup_of_timer(void)
irq = irq_of_parse_and_map(np, 0); irq = irq_of_parse_and_map(np, 0);
if (!irq) { if (!irq) {
pr_err("%s: No irq passed for timer via DT\n", __func__); pr_err("%s: No irq passed for timer via DT\n", __func__);
return; goto err_put_np;
} }
gpt_base = of_iomap(np, 0); gpt_base = of_iomap(np, 0);
if (!gpt_base) { if (!gpt_base) {
pr_err("%s: of iomap failed\n", __func__); pr_err("%s: of iomap failed\n", __func__);
return; goto err_put_np;
} }
gpt_clk = clk_get_sys("gpt0", NULL); gpt_clk = clk_get_sys("gpt0", NULL);
...@@ -239,6 +239,8 @@ void __init spear_setup_of_timer(void) ...@@ -239,6 +239,8 @@ void __init spear_setup_of_timer(void)
goto err_prepare_enable_clk; goto err_prepare_enable_clk;
} }
of_node_put(np);
spear_clockevent_init(irq); spear_clockevent_init(irq);
spear_clocksource_init(); spear_clocksource_init();
...@@ -248,4 +250,6 @@ void __init spear_setup_of_timer(void) ...@@ -248,4 +250,6 @@ void __init spear_setup_of_timer(void)
clk_put(gpt_clk); clk_put(gpt_clk);
err_iomap: err_iomap:
iounmap(gpt_base); iounmap(gpt_base);
err_put_np:
of_node_put(np);
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment