[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <84eb08daf85d203b34af9d8d08abf86804211413.1694961365.git.christophe.jaillet@wanadoo.fr>
Date: Sun, 17 Sep 2023 16:36:26 +0200
From: Christophe JAILLET <christophe.jaillet@...adoo.fr>
To: Radu Pirea <radu_nicolae.pirea@....ro>,
Mark Brown <broonie@...nel.org>,
Nicolas Ferre <nicolas.ferre@...rochip.com>,
Alexandre Belloni <alexandre.belloni@...tlin.com>,
Claudiu Beznea <claudiu.beznea@...on.dev>
Cc: linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org,
Christophe JAILLET <christophe.jaillet@...adoo.fr>,
linux-spi@...r.kernel.org, linux-arm-kernel@...ts.infradead.org
Subject: [PATCH] spi: at91-usart: Remove some dead code
dma_request_chan() does not return NULL. It returns a valid pointer or an
error pointer.
So, some dead code can be removed.
The IS_ERR_OR_NULL() in the error handling path are still needed, because
the error handling path is common to the whole function and the
ctlr->dma_xx are NULL when at91_usart_spi_configure_dma() is called.
Signed-off-by: Christophe JAILLET <christophe.jaillet@...adoo.fr>
---
drivers/spi/spi-at91-usart.c | 22 ++++------------------
1 file changed, 4 insertions(+), 18 deletions(-)
diff --git a/drivers/spi/spi-at91-usart.c b/drivers/spi/spi-at91-usart.c
index b11d0f993cc7..1cea8e159344 100644
--- a/drivers/spi/spi-at91-usart.c
+++ b/drivers/spi/spi-at91-usart.c
@@ -132,28 +132,14 @@ static int at91_usart_spi_configure_dma(struct spi_controller *ctlr,
dma_cap_set(DMA_SLAVE, mask);
ctlr->dma_tx = dma_request_chan(dev, "tx");
- if (IS_ERR_OR_NULL(ctlr->dma_tx)) {
- if (IS_ERR(ctlr->dma_tx)) {
- err = PTR_ERR(ctlr->dma_tx);
- goto at91_usart_spi_error_clear;
- }
-
- dev_dbg(dev,
- "DMA TX channel not available, SPI unable to use DMA\n");
- err = -EBUSY;
+ if (IS_ERR(ctlr->dma_tx)) {
+ err = PTR_ERR(ctlr->dma_tx);
goto at91_usart_spi_error_clear;
}
ctlr->dma_rx = dma_request_chan(dev, "rx");
- if (IS_ERR_OR_NULL(ctlr->dma_rx)) {
- if (IS_ERR(ctlr->dma_rx)) {
- err = PTR_ERR(ctlr->dma_rx);
- goto at91_usart_spi_error;
- }
-
- dev_dbg(dev,
- "DMA RX channel not available, SPI unable to use DMA\n");
- err = -EBUSY;
+ if (IS_ERR(ctlr->dma_rx)) {
+ err = PTR_ERR(ctlr->dma_rx);
goto at91_usart_spi_error;
}
--
2.34.1
Powered by blists - more mailing lists