Skip to contentSkip to conversation

mmc: bcm2835: Fix dma_unmap_sg() nents value

PATCH In review Thomas Fourier 2 participants 2 messages Jun 30, 2025 – Jul 3, 2025

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

PATCH 1/1 mmc: bcm2835: 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 2f5da678351f ("mmc: bcm2835: Properly handle dmaengine_prep_slave_sg")
---
 drivers/mmc/host/bcm2835.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/mmc/host/bcm2835.c +2 -1
index def054ddd256..4fced9b36c80 100644
@@ -503,7 +503,8 @@ void bcm2835_prepare_dma(struct bcm2835_host *host, struct mmc_data *data)
 				       DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
 
 	if (!desc) {
-		dma_unmap_sg(dma_chan->device->dev, data->sg, sg_len, dir_data);
+		dma_unmap_sg(dma_chan->device->dev, data->sg, data->sg_len,
+			     dir_data);
 		return;
 	}
 
Signature · 1 line
2.43.0
#1 lore raw
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 2f5da678351f ("mmc: bcm2835: Properly handle dmaengine_prep_slave_sg")

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

Kind regards
Uffe

Quoted 21 lines
---
 drivers/mmc/host/bcm2835.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/mmc/host/bcm2835.c +2 -2
index def054ddd256..4fced9b36c80 100644
@@ -503,7 +503,8 @@ void bcm2835_prepare_dma(struct bcm2835_host *host, struct mmc_data *data)
                                       DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
 
        if (!desc) {
-               dma_unmap_sg(dma_chan->device->dev, data->sg, sg_len, dir_data);
+               dma_unmap_sg(dma_chan->device->dev, data->sg, data->sg_len,
+                            dir_data);
                return;
        }
 
--

2.43.0