Skip to content

Commit

Permalink
mmc: core: Allow invalid regulator in mmc_regulator_set_ocr()
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
hkallweit authored and storulf committed Mar 23, 2023
1 parent 4453d51 commit 4b4b7ac
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/mmc/core/regulator.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 4b4b7ac

Please sign in to comment.