summaryrefslogtreecommitdiff
path: root/drivers/mmc/host/bcm2835.c
diff options
context:
space:
mode:
authorStefan Wahren <stefan.wahren@i2se.com>2018-11-11 21:23:59 +0100
committerUlf Hansson <ulf.hansson@linaro.org>2018-12-17 08:26:24 +0100
commit2f5da678351f0d504966fab113968202aa5713fb (patch)
treea4e56e520447eb4cf6d6a52e1350ae7f511aaca7 /drivers/mmc/host/bcm2835.c
parent6dc6f2619017109e45550accc120f823fdc31c3e (diff)
mmc: bcm2835: Properly handle dmaengine_prep_slave_sg
In case dmaengine_prep_slave_sg fails we need to call dma_unmap_sg. Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com> Acked-by: Eric Anholt <eric@anholt.net> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Diffstat (limited to 'drivers/mmc/host/bcm2835.c')
-rw-r--r--drivers/mmc/host/bcm2835.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/drivers/mmc/host/bcm2835.c b/drivers/mmc/host/bcm2835.c
index 7733dbd57073..50293529d6de 100644
--- a/drivers/mmc/host/bcm2835.c
+++ b/drivers/mmc/host/bcm2835.c
@@ -507,13 +507,16 @@ void bcm2835_prepare_dma(struct bcm2835_host *host, struct mmc_data *data)
desc = dmaengine_prep_slave_sg(dma_chan, data->sg, sg_len, dir_slave,
DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
- if (desc) {
- desc->callback = bcm2835_dma_complete;
- desc->callback_param = host;
- host->dma_desc = desc;
- host->dma_chan = dma_chan;
- host->dma_dir = dir_data;
+ if (!desc) {
+ dma_unmap_sg(dma_chan->device->dev, data->sg, sg_len, dir_data);
+ return;
}
+
+ desc->callback = bcm2835_dma_complete;
+ desc->callback_param = host;
+ host->dma_desc = desc;
+ host->dma_chan = dma_chan;
+ host->dma_dir = dir_data;
}
static void bcm2835_start_dma(struct bcm2835_host *host)