From 022b2343560297c05f432892b6360761163bc7f0 Mon Sep 17 00:00:00 2001 From: Dipak Shetty Date: Fri, 7 Jul 2023 20:17:58 +0200 Subject: [PATCH] drivers: spi: eliminate dead code in spi_mcux_lpspi The `spi_mcux_transceive` had 2 return calls when the `CONFIG_SPI_MCUX_LPSPI_DMA` flag was active. The first return would be called and the later was unreachable. With the fix, now the return calls are mutually exclusive. Also, the `transceive` call is not compiled with the `CONFIG_SPI_MCUX_LPSPI_DMA` flag is active. Fixes #59533 Signed-off-by: Dipak Shetty --- drivers/spi/spi_mcux_lpspi.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/spi/spi_mcux_lpspi.c b/drivers/spi/spi_mcux_lpspi.c index 7976c5d0087..7cca7947cb9 100644 --- a/drivers/spi/spi_mcux_lpspi.c +++ b/drivers/spi/spi_mcux_lpspi.c @@ -469,7 +469,7 @@ out: return ret; } -#endif +#else static int transceive(const struct device *dev, const struct spi_config *spi_cfg, @@ -502,6 +502,8 @@ out: return ret; } +#endif /*CONFIG_SPI_MCUX_LPSPI_DMA */ + static int spi_mcux_transceive(const struct device *dev, const struct spi_config *spi_cfg, const struct spi_buf_set *tx_bufs, @@ -509,8 +511,9 @@ static int spi_mcux_transceive(const struct device *dev, { #ifdef CONFIG_SPI_MCUX_LPSPI_DMA return transceive_dma(dev, spi_cfg, tx_bufs, rx_bufs, false, NULL, NULL); -#endif /* CONFIG_SPI_MCUX_LPSPI_DMA */ +#else return transceive(dev, spi_cfg, tx_bufs, rx_bufs, false, NULL, NULL); +#endif /* CONFIG_SPI_MCUX_LPSPI_DMA */ } #ifdef CONFIG_SPI_ASYNC