Skip to content

Commit

Permalink
clocksource/drivers/timer-ti-dm: Fix missing clk_disable_unprepare in…
Browse files Browse the repository at this point in the history
… dmtimer_systimer_init_clock()

[ Upstream commit 180d35a ]

If clk_get_rate() fails which is called after clk_prepare_enable(),
clk_disable_unprepare() need be called in error path to disable the
clock in dmtimer_systimer_init_clock().

Fixes: 52762fb ("clocksource/drivers/timer-ti-dm: Add clockevent and clocksource support")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Reviewed-by: Tony Lindgren <tony@atomide.com>
Link: https://lore.kernel.org/r/20221029114427.946520-1-yangyingliang@huawei.com
Signed-off-by: Daniel Lezcano <daniel.lezcano@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Yang Yingliang authored and gregkh committed Dec 31, 2022
1 parent 6b0a5f9 commit 404b4b9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/clocksource/timer-ti-dm-systimer.c
Original file line number Diff line number Diff line change
Expand Up @@ -345,8 +345,10 @@ static int __init dmtimer_systimer_init_clock(struct dmtimer_systimer *t,
return error;

r = clk_get_rate(clock);
if (!r)
if (!r) {
clk_disable_unprepare(clock);
return -ENODEV;
}

if (is_ick)
t->ick = clock;
Expand Down

0 comments on commit 404b4b9

Please sign in to comment.