Skip to content

Commit 1215c02

Browse files
lyrazhangstorulf
authored andcommitted
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: 36e1da4 (mmc: sdhci: add support for using external DMA devices) Reported-by: kbuild test robot <[email protected]> Signed-off-by: Chunyan Zhang <[email protected]> Reviewed-by: Nathan Chancellor <[email protected]> Acked-by: Adrian Hunter <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Ulf Hansson <[email protected]>
1 parent 6fac4a3 commit 1215c02

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

drivers/mmc/host/sdhci.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1201,6 +1201,7 @@ static int sdhci_external_dma_setup(struct sdhci_host *host,
12011201
struct mmc_command *cmd)
12021202
{
12031203
int ret, i;
1204+
enum dma_transfer_direction dir;
12041205
struct dma_async_tx_descriptor *desc;
12051206
struct mmc_data *data = cmd->data;
12061207
struct dma_chan *chan;
@@ -1234,8 +1235,8 @@ static int sdhci_external_dma_setup(struct sdhci_host *host,
12341235
if (sg_cnt <= 0)
12351236
return -EINVAL;
12361237

1237-
desc = dmaengine_prep_slave_sg(chan, data->sg, data->sg_len,
1238-
mmc_get_dma_dir(data),
1238+
dir = data->flags & MMC_DATA_WRITE ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM;
1239+
desc = dmaengine_prep_slave_sg(chan, data->sg, data->sg_len, dir,
12391240
DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
12401241
if (!desc)
12411242
return -EINVAL;

0 commit comments

Comments
 (0)