Skip to contentSkip to conversation

mci: sdhci: initialize dma state on non-data commands

PATCH Applied Lucas Stach 2 participants 2 messages Dec 13, 2024 – Dec 16, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mci: sdhci: initialize dma state on non-data commands

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.

---
 drivers/mci/sdhci.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/mci/sdhci.c +4 -1
index f1bb7f45d810..2c12f00ab967 100644
@@ -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);
 
Signature · 1 line
2.47.1
Applied
#1 lore raw
Quoted 8 lines · Lucas Stach

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,

Signature · 1 line
Sascha Hauer <[email protected]>