From 76c8bf0f7c3dc049e7a8ccdf060e8c20e6e002c8 Mon Sep 17 00:00:00 2001 From: Wojciech Sipak Date: Mon, 27 Nov 2023 12:10:10 +0100 Subject: [PATCH] drivers: interrupt_controller: intc_plic: rewrite `get_plic_dev_from_irq` There's a ternary operator that depends on configuration-defined macro: `CONFIG_DYNAMIC_INTERRUPTS` is not enabled by default for any of the platforms that use PLIC, it is possbile to set it to `=y` though. This triggered the Coverity check to report it as dead code. Fixes #65576. Signed-off-by: Wojciech Sipak --- drivers/interrupt_controller/intc_plic.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/interrupt_controller/intc_plic.c b/drivers/interrupt_controller/intc_plic.c index c579d28dad2..434274e8c41 100644 --- a/drivers/interrupt_controller/intc_plic.c +++ b/drivers/interrupt_controller/intc_plic.c @@ -116,10 +116,11 @@ static inline mem_addr_t get_threshold_priority_addr(const struct device *dev) */ static inline const struct device *get_plic_dev_from_irq(uint32_t irq) { - const struct device *dev = COND_CODE_1(IS_ENABLED(CONFIG_DYNAMIC_INTERRUPTS), - (z_get_sw_isr_device_from_irq(irq)), (NULL)); - - return dev == NULL ? DEVICE_DT_INST_GET(0) : dev; +#ifdef CONFIG_DYNAMIC_INTERRUPTS + return z_get_sw_isr_device_from_irq(irq); +#else + return DEVICE_DT_INST_GET(0); +#endif } /**