Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: fbe4b3566ddc ("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

authored by

Yang Yingliang and committed by
Daniel Lezcano
c1e6cad0 b6ea209e

+8 -3
+8 -3
drivers/clocksource/timer-orion.c
··· 143 143 irq = irq_of_parse_and_map(np, 1); 144 144 if (irq <= 0) { 145 145 pr_err("%pOFn: unable to parse timer1 irq\n", np); 146 - return -EINVAL; 146 + ret = -EINVAL; 147 + goto out_unprep_clk; 147 148 } 148 149 149 150 rate = clk_get_rate(clk); ··· 161 160 clocksource_mmio_readl_down); 162 161 if (ret) { 163 162 pr_err("Failed to initialize mmio timer\n"); 164 - return ret; 163 + goto out_unprep_clk; 165 164 } 166 165 167 166 sched_clock_register(orion_read_sched_clock, 32, rate); ··· 171 170 "orion_event", NULL); 172 171 if (ret) { 173 172 pr_err("%pOFn: unable to setup irq\n", np); 174 - return ret; 173 + goto out_unprep_clk; 175 174 } 176 175 177 176 ticks_per_jiffy = (clk_get_rate(clk) + HZ/2) / HZ; ··· 184 183 orion_delay_timer_init(rate); 185 184 186 185 return 0; 186 + 187 + out_unprep_clk: 188 + clk_disable_unprepare(clk); 189 + return ret; 187 190 } 188 191 TIMER_OF_DECLARE(orion_timer, "marvell,orion-timer", orion_timer_init);