[PATCH] mmc: core: allow errptr supply argument in, mmc_regulator_set_ocr

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <ulf.hansson@xxxxxxxxxx>
Signed-off-by: Heiner Kallweit <hkallweit1@xxxxxxxxx>
---
 drivers/mmc/core/regulator.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/mmc/core/regulator.c b/drivers/mmc/core/regulator.c
index 609201a46..4fad81cd5 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);
 
-- 
2.39.2




[Index of Archives]     [Linux Memonry Technology]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux