diff options
| author | Heiner Kallweit <[email protected]> | 2023-02-27 22:02:23 +0100 |
|---|---|---|
| committer | Ulf Hansson <[email protected]> | 2023-03-23 11:30:19 +0100 |
| commit | 4b4b7ac73704bfa796d2be6b96cb9072f7298861 (patch) | |
| tree | 5ed80460a36006917eeb9cb4ff925518944cb2d8 | |
| parent | 4453d51e1814a8b7c2e686e50241d7b28088622e (diff) | |
mmc: core: Allow invalid regulator in mmc_regulator_set_ocr()
Basically all host drivers use code like this:
if (!IS_ERR(mmc->supply.vmmc))
mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, 0)
Move the IS_ERR() check to mmc_regulator_set_ocr() to simplify host driver
code.
Suggested-by: Ulf Hansson <[email protected]>
Signed-off-by: Heiner Kallweit <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Ulf Hansson <[email protected]>
| -rw-r--r-- | drivers/mmc/core/regulator.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/mmc/core/regulator.c b/drivers/mmc/core/regulator.c index 609201a467ef..4fad81cd5252 100644 --- a/drivers/mmc/core/regulator.c +++ b/drivers/mmc/core/regulator.c @@ -110,6 +110,9 @@ int mmc_regulator_set_ocr(struct mmc_host *mmc, int result = 0; int min_uV, max_uV; + if (IS_ERR(supply)) + return 0; + if (vdd_bit) { mmc_ocrbitnum_to_vdd(vdd_bit, &min_uV, &max_uV); |