Skip to content

Commit 2c629dd

Browse files
windhlarndb
authored andcommitted
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: Liang He <windhl@126.com> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Link: https://lore.kernel.org/r/20220616093027.3984903-1-windhl@126.com' Signed-off-by: Arnd Bergmann <arnd@arndb.de>
1 parent 1ba904b commit 2c629dd

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

arch/arm/mach-spear/time.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,13 +218,13 @@ void __init spear_setup_of_timer(void)
218218
irq = irq_of_parse_and_map(np, 0);
219219
if (!irq) {
220220
pr_err("%s: No irq passed for timer via DT\n", __func__);
221-
return;
221+
goto err_put_np;
222222
}
223223

224224
gpt_base = of_iomap(np, 0);
225225
if (!gpt_base) {
226226
pr_err("%s: of iomap failed\n", __func__);
227-
return;
227+
goto err_put_np;
228228
}
229229

230230
gpt_clk = clk_get_sys("gpt0", NULL);
@@ -239,6 +239,8 @@ void __init spear_setup_of_timer(void)
239239
goto err_prepare_enable_clk;
240240
}
241241

242+
of_node_put(np);
243+
242244
spear_clockevent_init(irq);
243245
spear_clocksource_init();
244246

@@ -248,4 +250,6 @@ void __init spear_setup_of_timer(void)
248250
clk_put(gpt_clk);
249251
err_iomap:
250252
iounmap(gpt_base);
253+
err_put_np:
254+
of_node_put(np);
251255
}

0 commit comments

Comments
 (0)