Skip to content

Commit

Permalink
clocksource/drivers/orion: Add missing clk_disable_unprepare() on err…
Browse files Browse the repository at this point in the history
…or path

[ Upstream commit c1e6cad ]

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

Fixes: fbe4b35 ("clocksource/drivers/orion: Convert init function...")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20201111064706.3397156-1-yangyingliang@huawei.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Yang Yingliang authored and gregkh committed Dec 30, 2020
1 parent 40f9ac2 commit 742d5de
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions drivers/clocksource/timer-orion.c
Expand Up @@ -149,7 +149,8 @@ static int __init orion_timer_init(struct device_node *np)
irq = irq_of_parse_and_map(np, 1);
if (irq <= 0) {
pr_err("%pOFn: unable to parse timer1 irq\n", np);
return -EINVAL;
ret = -EINVAL;
goto out_unprep_clk;
}

rate = clk_get_rate(clk);
Expand All @@ -166,7 +167,7 @@ static int __init orion_timer_init(struct device_node *np)
clocksource_mmio_readl_down);
if (ret) {
pr_err("Failed to initialize mmio timer\n");
return ret;
goto out_unprep_clk;
}

sched_clock_register(orion_read_sched_clock, 32, rate);
Expand All @@ -175,7 +176,7 @@ static int __init orion_timer_init(struct device_node *np)
ret = setup_irq(irq, &orion_clkevt_irq);
if (ret) {
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;
Expand All @@ -188,5 +189,9 @@ static int __init orion_timer_init(struct device_node *np)
orion_delay_timer_init(rate);

return 0;

out_unprep_clk:
clk_disable_unprepare(clk);
return ret;
}
TIMER_OF_DECLARE(orion_timer, "marvell,orion-timer", orion_timer_init);

0 comments on commit 742d5de

Please sign in to comment.