Commit 730d9d4d authored by Andi Shyti's avatar Andi Shyti Committed by Mark Brown

spi: s3c64xx: simplify if statement in prepare_transfer function

The whole function is inside an 'if' statement
("!is_polling(sdd)").

Check the opposite of that statement at the beginning and exit,
this way we can have one level less of indentation.

Remove the goto paths as they are redundant.
Signed-off-by: default avatarAndi Shyti <andi.shyti@samsung.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 11f66f09
......@@ -341,9 +341,10 @@ static int s3c64xx_spi_prepare_transfer(struct spi_master *spi)
dma_filter_fn filter = sdd->cntrlr_info->filter;
struct device *dev = &sdd->pdev->dev;
dma_cap_mask_t mask;
int ret;
if (!is_polling(sdd)) {
if (is_polling(sdd))
return 0;
dma_cap_zero(mask);
dma_cap_set(DMA_SLAVE, mask);
......@@ -352,8 +353,7 @@ static int s3c64xx_spi_prepare_transfer(struct spi_master *spi)
sdd->cntrlr_info->dma_rx, dev, "rx");
if (!sdd->rx_dma.ch) {
dev_err(dev, "Failed to get RX DMA channel\n");
ret = -EBUSY;
goto out;
return -EBUSY;
}
spi->dma_rx = sdd->rx_dma.ch;
......@@ -361,18 +361,12 @@ static int s3c64xx_spi_prepare_transfer(struct spi_master *spi)
sdd->cntrlr_info->dma_tx, dev, "tx");
if (!sdd->tx_dma.ch) {
dev_err(dev, "Failed to get TX DMA channel\n");
ret = -EBUSY;
goto out_rx;
dma_release_channel(sdd->rx_dma.ch);
return -EBUSY;
}
spi->dma_tx = sdd->tx_dma.ch;
}
return 0;
out_rx:
dma_release_channel(sdd->rx_dma.ch);
out:
return ret;
}
static int s3c64xx_spi_unprepare_transfer(struct spi_master *spi)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment