The NXP STM timer has a 32-bit counter and 32-bit compare registers. Using ULONG_MAX as the max_delta parameter for clockevents_config_and_register() is incorrect on 64-bit platforms where unsigned long is 64 bits, as this exceeds the hardware's capability. Cap the max_delta to 0x7FFFFFFFU to match the 32-bit compare channel width, avoiding potential timer event misses or unexpected delays caused by programming an unreachable compare value. Fixes: cec32ac75827 ("clocksource/drivers/nxp-timer: Add the System Timer Module for the s32gx platforms") Signed-off-by: Enric Balletbo i Serra --- drivers/clocksource/timer-nxp-stm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/clocksource/timer-nxp-stm.c b/drivers/clocksource/timer-nxp-stm.c index 6fe098a4a33f..ee249fed1b91 100644 --- a/drivers/clocksource/timer-nxp-stm.c +++ b/drivers/clocksource/timer-nxp-stm.c @@ -346,7 +346,7 @@ static int nxp_stm_clockevent_starting_cpu(unsigned int cpu) * minimum ticks = (rate / MICRO) * 2 */ clockevents_config_and_register(&stm_timer->ced, stm_timer->rate, - (stm_timer->rate / MICRO) * 2, ULONG_MAX); + (stm_timer->rate / MICRO) * 2, 0x7FFFFFFFU); return 0; } -- 2.56.0