diff mbox series

[v1,17/19] mmc: meson-mx-sdhc: Fix error check for dma_map_sg

Message ID 20220819060801.10443-18-jinpu.wang@ionos.com (mailing list archive)
State New, archived
Headers show
Series None | expand

Commit Message

Jinpu Wang Aug. 19, 2022, 6:07 a.m. UTC
dma_map_sg return 0 on error.

Cc: Ulf Hansson <ulf.hansson@linaro.org>
Cc: Neil Armstrong <narmstrong@baylibre.com>
Cc: Kevin Hilman <khilman@baylibre.com>
Cc: Jerome Brunet <jbrunet@baylibre.com>
Cc: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Cc: linux-mmc@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-amlogic@lists.infradead.org
Cc: linux-kernel@vger.kernel.org

Signed-off-by: Jack Wang <jinpu.wang@ionos.com>
---
 drivers/mmc/host/meson-mx-sdhc-mmc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Martin Blumenstingl Aug. 20, 2022, 5:25 p.m. UTC | #1
Hello Jack,

first of all: thank you for this patch!

On Fri, Aug 19, 2022 at 8:08 AM Jack Wang <jinpu.wang@ionos.com> wrote:
[...]
> @@ -388,7 +388,7 @@ static int meson_mx_sdhc_map_dma(struct mmc_host *mmc, struct mmc_request *mrq)
>
>         dma_len = dma_map_sg(mmc_dev(mmc), data->sg, data->sg_len,
Does it also make sense to change the type of the dma_len variable
from (signed) int to "unsigned int" (a few lines above)?


Best regards,
Martin
Jinpu Wang Aug. 22, 2022, 5:15 a.m. UTC | #2
Hi Martin,
On Sat, Aug 20, 2022 at 7:26 PM Martin Blumenstingl
<martin.blumenstingl@googlemail.com> wrote:
>
> Hello Jack,
>
> first of all: thank you for this patch!
welcome.
>
> On Fri, Aug 19, 2022 at 8:08 AM Jack Wang <jinpu.wang@ionos.com> wrote:
> [...]
> > @@ -388,7 +388,7 @@ static int meson_mx_sdhc_map_dma(struct mmc_host *mmc, struct mmc_request *mrq)
> >
> >         dma_len = dma_map_sg(mmc_dev(mmc), data->sg, data->sg_len,
> Does it also make sense to change the type of the dma_len variable
> from (signed) int to "unsigned int" (a few lines above)?
I double checked, it seems a good idea, I will do it in v2.
>
>
> Best regards,
> Martin
Thx!
diff mbox series

Patch

diff --git a/drivers/mmc/host/meson-mx-sdhc-mmc.c b/drivers/mmc/host/meson-mx-sdhc-mmc.c
index e92e63cb5641..b32364f20c32 100644
--- a/drivers/mmc/host/meson-mx-sdhc-mmc.c
+++ b/drivers/mmc/host/meson-mx-sdhc-mmc.c
@@ -388,7 +388,7 @@  static int meson_mx_sdhc_map_dma(struct mmc_host *mmc, struct mmc_request *mrq)
 
 	dma_len = dma_map_sg(mmc_dev(mmc), data->sg, data->sg_len,
 			     mmc_get_dma_dir(data));
-	if (dma_len <= 0) {
+	if (!dma_len) {
 		dev_err(mmc_dev(mmc), "dma_map_sg failed\n");
 		return -ENOMEM;
 	}