From d721f765b51698b9e747cedc25c471c7b04bb2ff Mon Sep 17 00:00:00 2001 From: Kai Vehmanen Date: Wed, 27 Nov 2024 16:11:01 +0200 Subject: [PATCH] zephyr: lib: add build assert on NUM_CLOCKS Add a build assert to ensure platform NUM_CLOCKS is set to at least CONFIG_CORE_COUNT. This is assumed to hold in the implementation of platform_clock_init(). Signed-off-by: Kai Vehmanen --- zephyr/lib/clk.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/zephyr/lib/clk.c b/zephyr/lib/clk.c index 81094f229ce7..acb5e6734f83 100644 --- a/zephyr/lib/clk.c +++ b/zephyr/lib/clk.c @@ -28,6 +28,8 @@ void platform_clock_init(struct sof *sof) sof->clocks = platform_clocks_info; + BUILD_ASSERT(NUM_CLOCKS >= CONFIG_CORE_COUNT, "Invalid NUM_CLOCKS"); + for (i = 0; i < CONFIG_CORE_COUNT; i++) { sof->clocks[i] = (struct clock_info) { .freqs_num = NUM_CPU_FREQ,