summaryrefslogtreecommitdiff
path: root/drivers/mmc
diff options
context:
space:
mode:
authorChunyan Zhang <zhang.lyra@gmail.com>2020-01-20 11:32:23 +0800
committerUlf Hansson <ulf.hansson@linaro.org>2020-01-20 11:50:17 +0100
commit1215c025e870ba001cbfc1bed91a05f415fc0a1c (patch)
tree1a6ea5e8d8b7ad099254795019292638ee3932e9 /drivers/mmc
parent6fac4a3cb0599b32a3437356ab03e7be10e1f036 (diff)
mmc: sdhci: fix an issue of mixing different types
Fix an issue reported by sparse, since mixed types of parameters are used on calling dmaengine_prep_slave_sg(). Fixes: 36e1da441fec (mmc: sdhci: add support for using external DMA devices) Reported-by: kbuild test robot <lkp@intel.com> Signed-off-by: Chunyan Zhang <zhang.chunyan@linaro.org> Reviewed-by: Nathan Chancellor <natechancellor@gmail.com> Acked-by: Adrian Hunter <adrian.hunter@intel.com> Link: https://lore.kernel.org/r/20200120033223.897-1-zhang.chunyan@linaro.org Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Diffstat (limited to 'drivers/mmc')
-rw-r--r--drivers/mmc/host/sdhci.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 30b5a624b50e..f9e0b5f2c692 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -1201,6 +1201,7 @@ static int sdhci_external_dma_setup(struct sdhci_host *host,
struct mmc_command *cmd)
{
int ret, i;
+ enum dma_transfer_direction dir;
struct dma_async_tx_descriptor *desc;
struct mmc_data *data = cmd->data;
struct dma_chan *chan;
@@ -1234,8 +1235,8 @@ static int sdhci_external_dma_setup(struct sdhci_host *host,
if (sg_cnt <= 0)
return -EINVAL;
- desc = dmaengine_prep_slave_sg(chan, data->sg, data->sg_len,
- mmc_get_dma_dir(data),
+ dir = data->flags & MMC_DATA_WRITE ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM;
+ desc = dmaengine_prep_slave_sg(chan, data->sg, data->sg_len, dir,
DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
if (!desc)
return -EINVAL;