linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] clocksource/drivers/timer-ti-dm: fix missing clk_disable_unprepare in dmtimer_systimer_init_clock()
@ 2022-10-29 11:44 Yang Yingliang
  2022-10-31  8:28 ` Tony Lindgren
  2022-12-09 15:47 ` [tip: timers/core] clocksource/drivers/timer-ti-dm: Fix " tip-bot2 for Yang Yingliang
  0 siblings, 2 replies; 3+ messages in thread
From: Yang Yingliang @ 2022-10-29 11:44 UTC (permalink / raw)
  To: linux-kernel; +Cc: daniel.lezcano, tony, tglx

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: 52762fbd1c47 ("clocksource/drivers/timer-ti-dm: Add clockevent and clocksource support")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
v1 -> v2:
  Add fix tag.
  v1 patch link:
  https://lore.kernel.org/lkml/20220514084008.680446-1-yangyingliang@huawei.com/
---
 drivers/clocksource/timer-ti-dm-systimer.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/clocksource/timer-ti-dm-systimer.c b/drivers/clocksource/timer-ti-dm-systimer.c
index 2737407ff069..632523c1232f 100644
--- a/drivers/clocksource/timer-ti-dm-systimer.c
+++ b/drivers/clocksource/timer-ti-dm-systimer.c
@@ -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;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] clocksource/drivers/timer-ti-dm: fix missing clk_disable_unprepare in dmtimer_systimer_init_clock()
  2022-10-29 11:44 [PATCH v2] clocksource/drivers/timer-ti-dm: fix missing clk_disable_unprepare in dmtimer_systimer_init_clock() Yang Yingliang
@ 2022-10-31  8:28 ` Tony Lindgren
  2022-12-09 15:47 ` [tip: timers/core] clocksource/drivers/timer-ti-dm: Fix " tip-bot2 for Yang Yingliang
  1 sibling, 0 replies; 3+ messages in thread
From: Tony Lindgren @ 2022-10-31  8:28 UTC (permalink / raw)
  To: Yang Yingliang; +Cc: linux-kernel, daniel.lezcano, tglx

* Yang Yingliang <yangyingliang@huawei.com> [221029 11:36]:
> 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().

Reviewed-by: Tony Lindgren <tony@atomide.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [tip: timers/core] clocksource/drivers/timer-ti-dm: Fix missing clk_disable_unprepare in dmtimer_systimer_init_clock()
  2022-10-29 11:44 [PATCH v2] clocksource/drivers/timer-ti-dm: fix missing clk_disable_unprepare in dmtimer_systimer_init_clock() Yang Yingliang
  2022-10-31  8:28 ` Tony Lindgren
@ 2022-12-09 15:47 ` tip-bot2 for Yang Yingliang
  1 sibling, 0 replies; 3+ messages in thread
From: tip-bot2 for Yang Yingliang @ 2022-12-09 15:47 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Yang Yingliang, Tony Lindgren, Daniel Lezcano, x86, linux-kernel

The following commit has been merged into the timers/core branch of tip:

Commit-ID:     180d35a7c05d520314a590c99ad8643d0213f28b
Gitweb:        https://git.kernel.org/tip/180d35a7c05d520314a590c99ad8643d0213f28b
Author:        Yang Yingliang <yangyingliang@huawei.com>
AuthorDate:    Sat, 29 Oct 2022 19:44:27 +08:00
Committer:     Daniel Lezcano <daniel.lezcano@kernel.org>
CommitterDate: Fri, 02 Dec 2022 13:16:46 +01:00

clocksource/drivers/timer-ti-dm: Fix missing clk_disable_unprepare in dmtimer_systimer_init_clock()

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: 52762fbd1c47 ("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>
---
 drivers/clocksource/timer-ti-dm-systimer.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/clocksource/timer-ti-dm-systimer.c b/drivers/clocksource/timer-ti-dm-systimer.c
index 2737407..632523c 100644
--- a/drivers/clocksource/timer-ti-dm-systimer.c
+++ b/drivers/clocksource/timer-ti-dm-systimer.c
@@ -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;

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-12-09 15:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-29 11:44 [PATCH v2] clocksource/drivers/timer-ti-dm: fix missing clk_disable_unprepare in dmtimer_systimer_init_clock() Yang Yingliang
2022-10-31  8:28 ` Tony Lindgren
2022-12-09 15:47 ` [tip: timers/core] clocksource/drivers/timer-ti-dm: Fix " tip-bot2 for Yang Yingliang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).