Commit 8827f85e authored by Jack Wang's avatar Jack Wang Committed by Ulf Hansson

mmc: jz4740_mmc: Fix error check for dma_map_sg

dma_map_sg return 0 on error.
Signed-off-by: default avatarJack Wang <jinpu.wang@ionos.com>
Acked-by: default avatarPaul Cercueil <paul@crapouillou.net>
Link: https://lore.kernel.org/r/20220825074008.33349-3-jinpu.wang@ionos.comSigned-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
parent f7865ad8
...@@ -298,7 +298,7 @@ static int jz4740_mmc_prepare_dma_data(struct jz4740_mmc_host *host, ...@@ -298,7 +298,7 @@ static int jz4740_mmc_prepare_dma_data(struct jz4740_mmc_host *host,
{ {
struct dma_chan *chan = jz4740_mmc_get_dma_chan(host, data); struct dma_chan *chan = jz4740_mmc_get_dma_chan(host, data);
enum dma_data_direction dir = mmc_get_dma_dir(data); enum dma_data_direction dir = mmc_get_dma_dir(data);
int sg_count; unsigned int sg_count;
if (data->host_cookie == COOKIE_PREMAPPED) if (data->host_cookie == COOKIE_PREMAPPED)
return data->sg_count; return data->sg_count;
...@@ -308,7 +308,7 @@ static int jz4740_mmc_prepare_dma_data(struct jz4740_mmc_host *host, ...@@ -308,7 +308,7 @@ static int jz4740_mmc_prepare_dma_data(struct jz4740_mmc_host *host,
data->sg_len, data->sg_len,
dir); dir);
if (sg_count <= 0) { if (!sg_count) {
dev_err(mmc_dev(host->mmc), dev_err(mmc_dev(host->mmc),
"Failed to map scatterlist for DMA operation\n"); "Failed to map scatterlist for DMA operation\n");
return -EINVAL; return -EINVAL;
......
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