From a34d4d1ce9d96ddb2ed67686d5c30b8a0930734e Mon Sep 17 00:00:00 2001 From: Andriy Gelman Date: Thu, 28 Sep 2023 18:55:51 -0400 Subject: [PATCH] drivers: spi: xmc4xxx: Fix potential runtime error Fixes an unhandled interrupt runtime crash if CONFIG_SPI_XMC4XXX_DMA=y and CONFIG_SPI_XMC4XXX_INTERRUPT=n. The unhandled interrupt error is triggered because irq_enable() was called without calling IRQ_CONNECT() when CONFIG_SPI_XMC4XXX_INTERRUPT=n. Signed-off-by: Andriy Gelman --- drivers/spi/spi_xmc4xxx.c | 2 ++ tests/drivers/spi/spi_loopback/boards/xmc45_relax_kit.conf | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spi_xmc4xxx.c b/drivers/spi/spi_xmc4xxx.c index d6aa60a527f..1706572bddb 100644 --- a/drivers/spi/spi_xmc4xxx.c +++ b/drivers/spi/spi_xmc4xxx.c @@ -468,7 +468,9 @@ static int spi_xmc4xxx_transceive_dma(const struct device *dev, const struct spi spi_context_cs_control(ctx, false); } +#if defined(CONFIG_SPI_XMC4XXX_INTERRUPT) irq_enable(config->irq_num_rx); +#endif spi_context_release(ctx, ret); return ret; diff --git a/tests/drivers/spi/spi_loopback/boards/xmc45_relax_kit.conf b/tests/drivers/spi/spi_loopback/boards/xmc45_relax_kit.conf index d066213b5da..3f96b399e0e 100644 --- a/tests/drivers/spi/spi_loopback/boards/xmc45_relax_kit.conf +++ b/tests/drivers/spi/spi_loopback/boards/xmc45_relax_kit.conf @@ -1,3 +1,2 @@ -CONFIG_SPI_XMC4XXX_INTERRUPT=y CONFIG_SPI_XMC4XXX_DMA=y CONFIG_SPI_LOOPBACK_MODE_LOOP=y