[PATCH 5/9] mmc: dw_mmc: return error for invalid voltage setting
    Kaustabh Chakraborty 
    kauschluss at disroot.org
       
    Fri Oct 17 17:24:10 CEST 2025
    
    
  
In certain cases, the VQMMC regulator may not support certain voltages.
For instance, a VQMMC regulator which supports only up to 2.7V will not
accept 3.3V as an argument. This is unaccounted for, and thus the driver
incorrectly assumes that the voltage is set successfully.
Fetch the return value in a variable and return if it's non-zero.
(-ENOSYS is exempted as it implies that the voltage adjustment
functionality as a whole isn't supported).
Signed-off-by: Kaustabh Chakraborty <kauschluss at disroot.org>
---
 drivers/mmc/dw_mmc.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/mmc/dw_mmc.c b/drivers/mmc/dw_mmc.c
index 94b6641c44c39e67aac453c027d519c0e1580de6..9b143f9931e69531a53caa0196399e9392ddd348 100644
--- a/drivers/mmc/dw_mmc.c
+++ b/drivers/mmc/dw_mmc.c
@@ -649,9 +649,11 @@ static int dwmci_set_ios(struct mmc *mmc)
 			return ret;
 
 		if (mmc->signal_voltage == MMC_SIGNAL_VOLTAGE_180)
-			regulator_set_value(mmc->vqmmc_supply, 1800000);
+			ret = regulator_set_value(mmc->vqmmc_supply, 1800000);
 		else
-			regulator_set_value(mmc->vqmmc_supply, 3300000);
+			ret = regulator_set_value(mmc->vqmmc_supply, 3300000);
+		if (ret && ret != -ENOSYS)
+			return ret;
 
 		ret = regulator_set_enable_if_allowed(mmc->vqmmc_supply, true);
 		if (ret)
-- 
2.51.0
    
    
More information about the U-Boot
mailing list