diff mbox series

[2/2] mmc: jz4740_mmc: Fix error check for dma_map_sg

Message ID 20220825074008.33349-3-jinpu.wang@ionos.com (mailing list archive)
State New, archived
Headers show
Series mmc: Fix dma_map_sg error check | expand

Commit Message

Jinpu Wang Aug. 25, 2022, 7:40 a.m. UTC
dma_map_sg return 0 on error.

Cc: Paul Cercueil <paul@crapouillou.net>
Cc: Ulf Hansson <ulf.hansson@linaro.org>
Cc: linux-mips@vger.kernel.org
Cc: linux-mmc@vger.kernel.org
Cc: linux-kernel@vger.kernel.org

Signed-off-by: Jack Wang <jinpu.wang@ionos.com>
---
 drivers/mmc/host/jz4740_mmc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Paul Cercueil Aug. 25, 2022, 10:38 p.m. UTC | #1
Hi Jack,

Le jeu., août 25 2022 at 09:40:08 +0200, Jack Wang 
<jinpu.wang@ionos.com> a écrit :
> dma_map_sg return 0 on error.
> 
> Cc: Paul Cercueil <paul@crapouillou.net>
> Cc: Ulf Hansson <ulf.hansson@linaro.org>
> Cc: linux-mips@vger.kernel.org
> Cc: linux-mmc@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> 
> Signed-off-by: Jack Wang <jinpu.wang@ionos.com>

Acked-by: Paul Cercueil <paul@crapouillou.net>

Cheers,
-Paul

> ---
>  drivers/mmc/host/jz4740_mmc.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mmc/host/jz4740_mmc.c 
> b/drivers/mmc/host/jz4740_mmc.c
> index b1d563b2ed1b..dc2db9c185ea 100644
> --- a/drivers/mmc/host/jz4740_mmc.c
> +++ b/drivers/mmc/host/jz4740_mmc.c
> @@ -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);
>  	enum dma_data_direction dir = mmc_get_dma_dir(data);
> -	int sg_count;
> +	unsigned int sg_count;
> 
>  	if (data->host_cookie == COOKIE_PREMAPPED)
>  		return data->sg_count;
> @@ -308,7 +308,7 @@ static int jz4740_mmc_prepare_dma_data(struct 
> jz4740_mmc_host *host,
>  			data->sg_len,
>  			dir);
> 
> -	if (sg_count <= 0) {
> +	if (!sg_count) {
>  		dev_err(mmc_dev(host->mmc),
>  			"Failed to map scatterlist for DMA operation\n");
>  		return -EINVAL;
> --
> 2.34.1
>
diff mbox series

Patch

diff --git a/drivers/mmc/host/jz4740_mmc.c b/drivers/mmc/host/jz4740_mmc.c
index b1d563b2ed1b..dc2db9c185ea 100644
--- a/drivers/mmc/host/jz4740_mmc.c
+++ b/drivers/mmc/host/jz4740_mmc.c
@@ -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);
 	enum dma_data_direction dir = mmc_get_dma_dir(data);
-	int sg_count;
+	unsigned int sg_count;
 
 	if (data->host_cookie == COOKIE_PREMAPPED)
 		return data->sg_count;
@@ -308,7 +308,7 @@  static int jz4740_mmc_prepare_dma_data(struct jz4740_mmc_host *host,
 			data->sg_len,
 			dir);
 
-	if (sg_count <= 0) {
+	if (!sg_count) {
 		dev_err(mmc_dev(host->mmc),
 			"Failed to map scatterlist for DMA operation\n");
 		return -EINVAL;