Skip to content

Commit 8a77107

Browse files
tititiou36broonie
authored andcommitted
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 <[email protected]> Link: https://lore.kernel.org/r/84eb08daf85d203b34af9d8d08abf86804211413.1694961365.git.christophe.jaillet@wanadoo.fr Signed-off-by: Mark Brown <[email protected]>
1 parent 0fc57bf commit 8a77107

File tree

1 file changed

+4
-18
lines changed

1 file changed

+4
-18
lines changed

drivers/spi/spi-at91-usart.c

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -132,28 +132,14 @@ static int at91_usart_spi_configure_dma(struct spi_controller *ctlr,
132132
dma_cap_set(DMA_SLAVE, mask);
133133

134134
ctlr->dma_tx = dma_request_chan(dev, "tx");
135-
if (IS_ERR_OR_NULL(ctlr->dma_tx)) {
136-
if (IS_ERR(ctlr->dma_tx)) {
137-
err = PTR_ERR(ctlr->dma_tx);
138-
goto at91_usart_spi_error_clear;
139-
}
140-
141-
dev_dbg(dev,
142-
"DMA TX channel not available, SPI unable to use DMA\n");
143-
err = -EBUSY;
135+
if (IS_ERR(ctlr->dma_tx)) {
136+
err = PTR_ERR(ctlr->dma_tx);
144137
goto at91_usart_spi_error_clear;
145138
}
146139

147140
ctlr->dma_rx = dma_request_chan(dev, "rx");
148-
if (IS_ERR_OR_NULL(ctlr->dma_rx)) {
149-
if (IS_ERR(ctlr->dma_rx)) {
150-
err = PTR_ERR(ctlr->dma_rx);
151-
goto at91_usart_spi_error;
152-
}
153-
154-
dev_dbg(dev,
155-
"DMA RX channel not available, SPI unable to use DMA\n");
156-
err = -EBUSY;
141+
if (IS_ERR(ctlr->dma_rx)) {
142+
err = PTR_ERR(ctlr->dma_rx);
157143
goto at91_usart_spi_error;
158144
}
159145

0 commit comments

Comments
 (0)