[tip: timers/clocksource] clocksource/drivers/clps711x: Do not unmap clocksource MMIO

tip-bot2 for Guangshuo Li posted 1 patch 1 month, 1 week ago
drivers/clocksource/clps711x-timer.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[tip: timers/clocksource] clocksource/drivers/clps711x: Do not unmap clocksource MMIO
Posted by tip-bot2 for Guangshuo Li 1 month, 1 week ago
The following commit has been merged into the timers/clocksource branch of tip:

Commit-ID:     e998c6300ef4e062a704ee17b5a812c0b595cf42
Gitweb:        https://git.kernel.org/tip/e998c6300ef4e062a704ee17b5a812c0b595cf42
Author:        Guangshuo Li <lgs201920130244@gmail.com>
AuthorDate:    Sun, 05 Jul 2026 01:54:51 +08:00
Committer:     Daniel Lezcano <daniel.lezcano@kernel.org>
CommitterDate: Thu, 13 Aug 2026 18:13:15 +02:00

clocksource/drivers/clps711x: Do not unmap clocksource MMIO

clps711x_clksrc_init() stores the timer base address in the static tcd
pointer and registers it as both the clocksource MMIO address and the
sched_clock read address.

The clocksource init path must therefore keep the mapping alive after
clps711x_timer_init() returns. However, the shared unmap_io exit path is
also reached after successful clocksource registration, so the MMIO
mapping is torn down while the clocksource and sched_clock readers may
still access it.

Return directly after successful clocksource registration and leave the
mapping alive for the registered readers. Keep the unmap_io path for the
error paths and for the clockevent init path.

Fixes: cd32e596f02f ("clocksource/drivers/clps711x: Fix resource leaks in error paths")
Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@kernel.org>
Link: https://patch.msgid.link/20260704175451.256364-1-lgs201920130244@gmail.com
---
 drivers/clocksource/clps711x-timer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clocksource/clps711x-timer.c b/drivers/clocksource/clps711x-timer.c
index bb0a44a..63ae3a6 100644
--- a/drivers/clocksource/clps711x-timer.c
+++ b/drivers/clocksource/clps711x-timer.c
@@ -94,7 +94,7 @@ static int __init clps711x_timer_init(struct device_node *np)
 	switch (of_alias_get_id(np, "timer")) {
 	case CLPS711X_CLKSRC_CLOCKSOURCE:
 		clps711x_clksrc_init(clock, base);
-		break;
+		return 0;
 	case CLPS711X_CLKSRC_CLOCKEVENT:
 		ret =  _clps711x_clkevt_init(clock, base, irq);
 		break;