diff --git a/drivers/timer/cortex_m_systick.c b/drivers/timer/cortex_m_systick.c index ebe6a728f4c..cb95845cd6b 100644 --- a/drivers/timer/cortex_m_systick.c +++ b/drivers/timer/cortex_m_systick.c @@ -15,7 +15,7 @@ #define CYC_PER_TICK (sys_clock_hw_cycles_per_sec() \ / CONFIG_SYS_CLOCK_TICKS_PER_SEC) -#define MAX_TICKS ((COUNTER_MAX / CYC_PER_TICK) - 1) +#define MAX_TICKS ((k_ticks_t)(COUNTER_MAX / CYC_PER_TICK) - 1) #define MAX_CYCLES (MAX_TICKS * CYC_PER_TICK) /* Minimum cycles in the future to try to program. Note that this is @@ -27,7 +27,7 @@ * masked. Choosing a fraction of a tick is probably a good enough * default, with an absolute minimum of 1k cyc. */ -#define MIN_DELAY MAX(1024, (CYC_PER_TICK/16)) +#define MIN_DELAY MAX(1024U, ((uint32_t)CYC_PER_TICK/16U)) #define TICKLESS (IS_ENABLED(CONFIG_TICKLESS_KERNEL))