From: Heiner Kallweit Date: Mon, 27 Feb 2023 21:02:23 +0000 (+0100) Subject: mmc: core: Allow invalid regulator in mmc_regulator_set_ocr() X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=4b4b7ac73704bfa796d2be6b96cb9072f7298861;p=linux.git 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 Signed-off-by: Heiner Kallweit Link: https://lore.kernel.org/r/0c1e7440-f4bc-b48a-137f-58b75ac98550@gmail.com Signed-off-by: Ulf Hansson --- diff --git a/drivers/mmc/core/regulator.c b/drivers/mmc/core/regulator.c index 609201a467ef9..4fad81cd5252b 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);