From 8be8aab9bbeafc7fae9958d6561a369092b2c259 Mon Sep 17 00:00:00 2001 From: Gustavo Henrique Nihei Date: Mon, 3 Apr 2023 15:43:04 -0300 Subject: [PATCH] risc-v/espressif: Panic if CPU interrupt allocation fails Signed-off-by: Gustavo Henrique Nihei --- arch/risc-v/src/espressif/esp_irq.c | 8 +++----- arch/risc-v/src/espressif/esp_irq.h | 3 +-- arch/risc-v/src/espressif/esp_serial.c | 4 ---- 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/arch/risc-v/src/espressif/esp_irq.c b/arch/risc-v/src/espressif/esp_irq.c index d42e6e5cd7..f43a1532ff 100644 --- a/arch/risc-v/src/espressif/esp_irq.c +++ b/arch/risc-v/src/espressif/esp_irq.c @@ -422,8 +422,7 @@ void esp_route_intr(int source, int cpuint, irq_priority_t priority, * type - Interrupt trigger type. * * Returned Value: - * The allocated CPU interrupt on success, a negated errno value on - * failure. + * Allocated CPU interrupt. * ****************************************************************************/ @@ -449,11 +448,10 @@ int esp_setup_irq(int source, irq_priority_t priority, irq_trigger_t type) cpuint = esp_cpuint_alloc(irq); if (cpuint < 0) { - irqerr("Unable to allocate CPU interrupt for priority=%d and type=%d", + _alert("Unable to allocate CPU interrupt for source=%d\n", priority, type); - leave_critical_section(irqstate); - return cpuint; + PANIC(); } esp_route_intr(source, cpuint, priority, type); diff --git a/arch/risc-v/src/espressif/esp_irq.h b/arch/risc-v/src/espressif/esp_irq.h index 665f6a4876..6c7a47c146 100644 --- a/arch/risc-v/src/espressif/esp_irq.h +++ b/arch/risc-v/src/espressif/esp_irq.h @@ -115,8 +115,7 @@ void esp_route_intr(int source, int cpuint, irq_priority_t priority, * type - Interrupt trigger type. * * Returned Value: - * The allocated CPU interrupt on success, a negated errno value on - * failure. + * Allocated CPU interrupt. * ****************************************************************************/ diff --git a/arch/risc-v/src/espressif/esp_serial.c b/arch/risc-v/src/espressif/esp_serial.c index b99cfb99c7..31b0ee0e1a 100644 --- a/arch/risc-v/src/espressif/esp_serial.c +++ b/arch/risc-v/src/espressif/esp_serial.c @@ -493,10 +493,6 @@ static int esp_attach(uart_dev_t *dev) priv->cpuint = esp_setup_irq(priv->source, priv->int_pri, ESP_IRQ_TRIGGER_LEVEL); - if (priv->cpuint < 0) - { - return priv->cpuint; - } /* Attach and enable the IRQ */