Commit c1e6cad0 authored by Yang Yingliang's avatar Yang Yingliang Committed by Daniel Lezcano

clocksource/drivers/orion: Add missing clk_disable_unprepare() on error path

After calling clk_prepare_enable(), clk_disable_unprepare() need
be called on error path.

Fixes: fbe4b356 ("clocksource/drivers/orion: Convert init function...")
Reported-by: default avatarHulk Robot <hulkci@huawei.com>
Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
Signed-off-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20201111064706.3397156-1-yangyingliang@huawei.com
parent b6ea209e
...@@ -143,7 +143,8 @@ static int __init orion_timer_init(struct device_node *np) ...@@ -143,7 +143,8 @@ static int __init orion_timer_init(struct device_node *np)
irq = irq_of_parse_and_map(np, 1); irq = irq_of_parse_and_map(np, 1);
if (irq <= 0) { if (irq <= 0) {
pr_err("%pOFn: unable to parse timer1 irq\n", np); pr_err("%pOFn: unable to parse timer1 irq\n", np);
return -EINVAL; ret = -EINVAL;
goto out_unprep_clk;
} }
rate = clk_get_rate(clk); rate = clk_get_rate(clk);
...@@ -160,7 +161,7 @@ static int __init orion_timer_init(struct device_node *np) ...@@ -160,7 +161,7 @@ static int __init orion_timer_init(struct device_node *np)
clocksource_mmio_readl_down); clocksource_mmio_readl_down);
if (ret) { if (ret) {
pr_err("Failed to initialize mmio timer\n"); pr_err("Failed to initialize mmio timer\n");
return ret; goto out_unprep_clk;
} }
sched_clock_register(orion_read_sched_clock, 32, rate); sched_clock_register(orion_read_sched_clock, 32, rate);
...@@ -170,7 +171,7 @@ static int __init orion_timer_init(struct device_node *np) ...@@ -170,7 +171,7 @@ static int __init orion_timer_init(struct device_node *np)
"orion_event", NULL); "orion_event", NULL);
if (ret) { if (ret) {
pr_err("%pOFn: unable to setup irq\n", np); pr_err("%pOFn: unable to setup irq\n", np);
return ret; goto out_unprep_clk;
} }
ticks_per_jiffy = (clk_get_rate(clk) + HZ/2) / HZ; ticks_per_jiffy = (clk_get_rate(clk) + HZ/2) / HZ;
...@@ -183,5 +184,9 @@ static int __init orion_timer_init(struct device_node *np) ...@@ -183,5 +184,9 @@ static int __init orion_timer_init(struct device_node *np)
orion_delay_timer_init(rate); orion_delay_timer_init(rate);
return 0; return 0;
out_unprep_clk:
clk_disable_unprepare(clk);
return ret;
} }
TIMER_OF_DECLARE(orion_timer, "marvell,orion-timer", orion_timer_init); TIMER_OF_DECLARE(orion_timer, "marvell,orion-timer", orion_timer_init);
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