Skip to contentSkip to conversation

mmc: mvsdio: Fix dma_unmap_sg() nents value

PATCH In review Thomas Fourier 3 participants 3 messages Aug 26, 2025 – Sep 12, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mmc: mvsdio: Fix dma_unmap_sg() nents value

The dma_unmap_sg() functions should be called with the same nents as the dma_map_sg(), not the value the map function returned.

Fixes 236caa7cc351 ("mmc: SDIO driver for Marvell SoCs")
---
 drivers/mmc/host/mvsdio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/host/mvsdio.c +1 -1
index a9e6277789ba..79df2fa89a3f 100644
@@ -292,7 +292,7 @@ static u32 mvsd_finish_data(struct mvsd_host *host, struct mmc_data *data,
 		host->pio_ptr = NULL;
 		host->pio_size = 0;
 	} else {
-		dma_unmap_sg(mmc_dev(host->mmc), data->sg, host->sg_frags,
+		dma_unmap_sg(mmc_dev(host->mmc), data->sg, data->sg_len,
 			     mmc_get_dma_dir(data));
 	}
 
Signature · 1 line
2.43.0
#2 lore raw
In reply to Thomas Fourier
Quoted 6 lines · Thomas Fourier

The dma_unmap_sg() functions should be called with the same nents as the dma_map_sg(), not the value the map function returned.

Fixes 236caa7cc351 ("mmc: SDIO driver for Marvell SoCs")

Applied for fixes and by adding a stable tag, thanks!

Kind regards
Uffe

Quoted 20 lines
---
 drivers/mmc/host/mvsdio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/host/mvsdio.c +1 -2
index a9e6277789ba..79df2fa89a3f 100644
@@ -292,7 +292,7 @@ static u32 mvsd_finish_data(struct mvsd_host *host, struct mmc_data *data,
                host->pio_ptr = NULL;
                host->pio_size = 0;
        } else {
-               dma_unmap_sg(mmc_dev(host->mmc), data->sg, host->sg_frags,
+               dma_unmap_sg(mmc_dev(host->mmc), data->sg, data->sg_len,
                             mmc_get_dma_dir(data));
        }
 
--

2.43.0