From 03f46db8591e191eaf8744ab36f8401aac102def Mon Sep 17 00:00:00 2001 From: Carles Cufi Date: Thu, 5 Jun 2025 16:52:30 +0200 Subject: [PATCH] include: sys_clock: Fix compilation when SYS_CLOCK_EXISTS is disabled If `CONFIG_SYS_CLOCK_EXISTS=n`, then `CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC` will likely not be defined at all. Fix the compilation by moving the check for it being `== 0` to a separate preprocessor #if statement. Signed-off-by: Carles Cufi --- include/zephyr/sys_clock.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/include/zephyr/sys_clock.h b/include/zephyr/sys_clock.h index 6c3589a5102..5f31d585ff1 100644 --- a/include/zephyr/sys_clock.h +++ b/include/zephyr/sys_clock.h @@ -162,10 +162,11 @@ typedef struct { /** @endcond */ #ifndef CONFIG_TIMER_READS_ITS_FREQUENCY_AT_RUNTIME -#if defined(CONFIG_SYS_CLOCK_EXISTS) && \ - (CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC == 0) +#if defined(CONFIG_SYS_CLOCK_EXISTS) +#if CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC == 0 #error "SYS_CLOCK_HW_CYCLES_PER_SEC must be non-zero!" -#endif +#endif /* CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC == 0 */ +#endif /* CONFIG_SYS_CLOCK_EXISTS */ #endif /* CONFIG_TIMER_READS_ITS_FREQUENCY_AT_RUNTIME */ /* kernel clocks */