Skip to contentSkip to conversation

clocksource/drivers/clps711x: Do not unmap clocksource MMIO

PATCH Applied Guangshuo Li 2 participants 2 messages Jul 4 – Aug 17 Clocksource, clockevent drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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")
---
 drivers/clocksource/clps711x-timer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clocksource/clps711x-timer.c +1 -1
index bb0a44adaf28..63ae3a691b14 100644
@@ -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;
Signature · 1 line
2.43.0
merge bot Applied
#1 lore raw
The following commit has been merged into the timers/clocksource branch of tip:

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 <[email protected]>
AuthorDate:    Sun, 05 Jul 2026 01:54:51 +08:00
Committer:     Daniel Lezcano <[email protected]>
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")
---
 drivers/clocksource/clps711x-timer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clocksource/clps711x-timer.c +1 -1
index bb0a44a..63ae3a6 100644
@@ -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;