mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] mci: sdhci: initialize dma state on non-data commands
@ 2024-12-13 20:58 Lucas Stach
  2024-12-16  8:29 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Lucas Stach @ 2024-12-13 20:58 UTC (permalink / raw)
  To: barebox

Commands without data will leave the dma parameter uninitialized
in sdhci_setup_data_dma(). Drivers then decide whether to set
SDHCI_DMA_EN based on this uninitialized data. This seems to be
mostly harmless as the host controllers seem to ignore this bit
on non-data commands, but it's still a bit confusing. Make sure
to always return a valid state.

Signed-off-by: Lucas Stach <dev@lynxeye.de>
---
 drivers/mci/sdhci.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/mci/sdhci.c b/drivers/mci/sdhci.c
index f1bb7f45d810..2c12f00ab967 100644
--- a/drivers/mci/sdhci.c
+++ b/drivers/mci/sdhci.c
@@ -478,8 +478,11 @@ void sdhci_setup_data_dma(struct sdhci *sdhci, struct mci_data *data,
 	struct device *dev = sdhci_dev(sdhci);
 	int nbytes;
 
-	if (!data)
+	if (!data) {
+		if (dma)
+			*dma = SDHCI_NO_DMA;
 		return;
+	}
 
 	sdhci_setup_data_pio(sdhci, data);
 
-- 
2.47.1




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

* Re: [PATCH] mci: sdhci: initialize dma state on non-data commands
  2024-12-13 20:58 [PATCH] mci: sdhci: initialize dma state on non-data commands Lucas Stach
@ 2024-12-16  8:29 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2024-12-16  8:29 UTC (permalink / raw)
  To: barebox, Lucas Stach


On Fri, 13 Dec 2024 21:58:15 +0100, Lucas Stach wrote:
> Commands without data will leave the dma parameter uninitialized
> in sdhci_setup_data_dma(). Drivers then decide whether to set
> SDHCI_DMA_EN based on this uninitialized data. This seems to be
> mostly harmless as the host controllers seem to ignore this bit
> on non-data commands, but it's still a bit confusing. Make sure
> to always return a valid state.
> 
> [...]

Applied, thanks!

[1/1] mci: sdhci: initialize dma state on non-data commands
      https://git.pengutronix.de/cgit/barebox/commit/?id=ce07b7ed0266 (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:[~2024-12-16  8:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-12-13 20:58 [PATCH] mci: sdhci: initialize dma state on non-data commands Lucas Stach
2024-12-16  8:29 ` Sascha Hauer

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