diff --git a/kernel/timer.c b/kernel/timer.c index b88c5dcc4e6..8bdff9a590d 100644 --- a/kernel/timer.c +++ b/kernel/timer.c @@ -126,7 +126,8 @@ void z_impl_k_timer_start(struct k_timer *timer, k_timeout_t duration, * argument the same way k_sleep() does), but historical. The * timer_api test relies on this behavior. */ - if (period.ticks != 0 && Z_TICK_ABS(period.ticks) < 0) { + if (!K_TIMEOUT_EQ(period, K_FOREVER) && period.ticks != 0 && + Z_TICK_ABS(period.ticks) < 0) { period.ticks = MAX(period.ticks - 1, 1); } if (Z_TICK_ABS(duration.ticks) < 0) {