diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2013-04-18 18:12:00 +0100 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2013-04-18 18:17:27 +0100 |
commit | fb9d044efbb54918f35a718691126248b236a06e (patch) | |
tree | 6dc24810933935d861210eef00555479a79e05f4 /drivers/spi | |
parent | 563b444e33810f3120838620c990480304e24e63 (diff) | |
download | op-kernel-dev-fb9d044efbb54918f35a718691126248b236a06e.zip op-kernel-dev-fb9d044efbb54918f35a718691126248b236a06e.tar.gz |
spi/s3c64xx: Check for errors in dmaengine prepare_transfer()
Don't silently ignore errors, report them.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/spi')
-rw-r--r-- | drivers/spi/spi-s3c64xx.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c index 6d6537d..5000586 100644 --- a/drivers/spi/spi-s3c64xx.c +++ b/drivers/spi/spi-s3c64xx.c @@ -421,6 +421,7 @@ 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; dma_cap_zero(mask); dma_cap_set(DMA_SLAVE, mask); @@ -428,11 +429,34 @@ static int s3c64xx_spi_prepare_transfer(struct spi_master *spi) /* Acquire DMA channels */ sdd->rx_dma.ch = dma_request_slave_channel_compat(mask, filter, (void*)sdd->rx_dma.dmach, dev, "rx"); + if (!sdd->rx_dma.ch) { + dev_err(dev, "Failed to get RX DMA channel\n"); + ret = -EBUSY; + goto out; + } + sdd->tx_dma.ch = dma_request_slave_channel_compat(mask, filter, (void*)sdd->tx_dma.dmach, dev, "tx"); - pm_runtime_get_sync(&sdd->pdev->dev); + if (!sdd->tx_dma.ch) { + dev_err(dev, "Failed to get TX DMA channel\n"); + ret = -EBUSY; + goto out_rx; + } + + ret = pm_runtime_get_sync(&sdd->pdev->dev); + if (ret != 0) { + dev_err(dev, "Failed to enable device: %d\n", ret); + goto out_tx; + } return 0; + +out_tx: + dma_release_channel(sdd->tx_dma.ch); +out_rx: + dma_release_channel(sdd->rx_dma.ch); +out: + return ret; } static int s3c64xx_spi_unprepare_transfer(struct spi_master *spi) |