mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] mci: stm32_sdmmc2: fix benign typo in dma_map_single
@ 2025-04-10 13:03 Ahmad Fatoum
  2025-04-11  7:14 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2025-04-10 13:03 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

struct mci_data::src and ::dest are members of the same union and thus
can be used interchangeably, provided that the difference in type is
accounted for.

Nevertheless, it makes code easier to reason about and saves needless
casts to use the correct union member. Do that for the read case.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 drivers/mci/stm32_sdmmc2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mci/stm32_sdmmc2.c b/drivers/mci/stm32_sdmmc2.c
index 64a7171d2cae..30745ea7c6c0 100644
--- a/drivers/mci/stm32_sdmmc2.c
+++ b/drivers/mci/stm32_sdmmc2.c
@@ -271,7 +271,7 @@ static dma_addr_t stm32_sdmmc2_start_data(struct stm32_sdmmc2_priv *priv,
 
 	if (data->flags & MMC_DATA_READ) {
 		data_ctrl |= SDMMC_DCTRL_DTDIR;
-		idmabase0 = dma_map_single(priv->dev, (void *)data->src, num_bytes,
+		idmabase0 = dma_map_single(priv->dev, data->dest, num_bytes,
 					   DMA_FROM_DEVICE);
 	} else {
 		idmabase0 = dma_map_single(priv->dev, (void *)data->src, num_bytes,
-- 
2.39.5




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

* Re: [PATCH] mci: stm32_sdmmc2: fix benign typo in dma_map_single
  2025-04-10 13:03 [PATCH] mci: stm32_sdmmc2: fix benign typo in dma_map_single Ahmad Fatoum
@ 2025-04-11  7:14 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2025-04-11  7:14 UTC (permalink / raw)
  To: barebox, Ahmad Fatoum


On Thu, 10 Apr 2025 15:03:02 +0200, Ahmad Fatoum wrote:
> struct mci_data::src and ::dest are members of the same union and thus
> can be used interchangeably, provided that the difference in type is
> accounted for.
> 
> Nevertheless, it makes code easier to reason about and saves needless
> casts to use the correct union member. Do that for the read case.
> 
> [...]

Applied, thanks!

[1/1] mci: stm32_sdmmc2: fix benign typo in dma_map_single
      https://git.pengutronix.de/cgit/barebox/commit/?id=3c0e5d6684a6 (link may not be stable)

Best regards,
-- 
Sascha Hauer <s.hauer@pengutronix.de>




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

end of thread, other threads:[~2025-04-11  7:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-04-10 13:03 [PATCH] mci: stm32_sdmmc2: fix benign typo in dma_map_single Ahmad Fatoum
2025-04-11  7:14 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox