Unverified Commit 8a771075 authored by Christophe JAILLET's avatar Christophe JAILLET Committed by Mark Brown
Browse files

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: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/84eb08daf85d203b34af9d8d08abf86804211413.1694961365.git.christophe.jaillet@wanadoo.fr


Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 0fc57bf1
Loading
Loading
Loading
Loading
+4 −18
Original line number Diff line number Diff line
@@ -132,31 +132,17 @@ 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;
		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;
		goto at91_usart_spi_error;
	}

	slave_config.dst_addr_width = DMA_SLAVE_BUSWIDTH_1_BYTE;
	slave_config.src_addr_width = DMA_SLAVE_BUSWIDTH_1_BYTE;
	slave_config.dst_addr = (dma_addr_t)phybase + US_THR;