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 <[email protected]>
---
 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


Reply via email to