From d19c499037eb4a60ddc592bed08cd59be809de86 Mon Sep 17 00:00:00 2001 From: Mika Braunschweig Date: Mon, 31 Mar 2025 16:54:50 +0200 Subject: [PATCH] drivers: interrupt-controller: vim: Compare interrupt numbers To avoid misconfigurations a comparision has been added which compares the amount of reported interrupts from the VIM interrupt controller with the configured number of interrupts via Kconfig. Signed-off-by: Mika Braunschweig --- drivers/interrupt_controller/intc_vim.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/interrupt_controller/intc_vim.c b/drivers/interrupt_controller/intc_vim.c index d5d235edf4a..d37aac051d1 100644 --- a/drivers/interrupt_controller/intc_vim.c +++ b/drivers/interrupt_controller/intc_vim.c @@ -15,6 +15,7 @@ #include #include #include +#include "zephyr/sys/__assert.h" #include LOG_MODULE_REGISTER(vim); @@ -58,6 +59,11 @@ void z_vim_irq_eoi(unsigned int irq) void z_vim_irq_init(void) { uint32_t num_of_irqs = sys_read32(VIM_INFO) & VIM_INFO_INTERRUPTS_MASK; + + __ASSERT(CONFIG_NUM_IRQS == num_of_irqs, + "Number of configured interrupts (%d) doesn't match reported " + "(%" PRIu32 ") interrupts", + CONFIG_NUM_IRQS, num_of_irqs); LOG_DBG("VIM: Number of IRQs = %u\n", num_of_irqs); }