linux-mmc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mmc: bcm2835: Fix dma_unmap_sg() nents value
@ 2025-06-30  9:35 Thomas Fourier
  2025-07-03 12:19 ` Ulf Hansson
  0 siblings, 1 reply; 2+ messages in thread
From: Thomas Fourier @ 2025-06-30  9:35 UTC (permalink / raw)
  Cc: Thomas Fourier, Ulf Hansson, Florian Fainelli, Ray Jui,
	Scott Branden, Broadcom internal kernel review list,
	Stefan Wahren, Uwe Kleine-König, Yumeng Fang, Eric Anholt,
	linux-mmc, linux-rpi-kernel, linux-arm-kernel, linux-kernel

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")
Signed-off-by: Thomas Fourier <fourier.thomas@gmail.com>
---
 drivers/mmc/host/bcm2835.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/host/bcm2835.c b/drivers/mmc/host/bcm2835.c
index def054ddd256..4fced9b36c80 100644
--- a/drivers/mmc/host/bcm2835.c
+++ b/drivers/mmc/host/bcm2835.c
@@ -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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] mmc: bcm2835: Fix dma_unmap_sg() nents value
  2025-06-30  9:35 [PATCH] mmc: bcm2835: Fix dma_unmap_sg() nents value Thomas Fourier
@ 2025-07-03 12:19 ` Ulf Hansson
  0 siblings, 0 replies; 2+ messages in thread
From: Ulf Hansson @ 2025-07-03 12:19 UTC (permalink / raw)
  To: Thomas Fourier
  Cc: Florian Fainelli, Ray Jui, Scott Branden,
	Broadcom internal kernel review list, Stefan Wahren,
	Uwe Kleine-König, Yumeng Fang, Eric Anholt, linux-mmc,
	linux-rpi-kernel, linux-arm-kernel, linux-kernel

On Mon, 30 Jun 2025 at 11:35, Thomas Fourier <fourier.thomas@gmail.com> wrote:
>
> 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")
> Signed-off-by: Thomas Fourier <fourier.thomas@gmail.com>

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

Kind regards
Uffe


> ---
>  drivers/mmc/host/bcm2835.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/host/bcm2835.c b/drivers/mmc/host/bcm2835.c
> index def054ddd256..4fced9b36c80 100644
> --- a/drivers/mmc/host/bcm2835.c
> +++ b/drivers/mmc/host/bcm2835.c
> @@ -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
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-07-03 12:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-30  9:35 [PATCH] mmc: bcm2835: Fix dma_unmap_sg() nents value Thomas Fourier
2025-07-03 12:19 ` Ulf Hansson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).