aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKishon Vijay Abraham I2017-06-05 23:49:37 -0500
committerKishon Vijay Abraham I2017-06-15 00:52:52 -0500
commitea9684a30e89d010691d94d8306d4ed6e28c42e6 (patch)
tree4ac9d5fae7876795ea436d4570d02666ae8d2a63
parentd21f8fb8bb2f0c235e65cf7a1178769a0e25b2ef (diff)
downloadlinux-phy-ea9684a30e89d010691d94d8306d4ed6e28c42e6.tar.gz
linux-phy-ea9684a30e89d010691d94d8306d4ed6e28c42e6.tar.xz
linux-phy-ea9684a30e89d010691d94d8306d4ed6e28c42e6.zip
mmc: host: omap_hsmmc: Do not initialize MMC regulators to NULL on error
Do not initialize MMC regulators to NULL on error in omap_hsmmc driver similar to what is done in mmc_regulator_get_supply(). This is in preparation for using mmc_regulator_get_supply() to get MMC regulators. Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
-rw-r--r--drivers/mmc/host/omap_hsmmc.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 8c39dccacf39..de82ac0a87e2 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -250,14 +250,14 @@ static int omap_hsmmc_enable_supply(struct mmc_host *mmc)
250 struct omap_hsmmc_host *host = mmc_priv(mmc); 250 struct omap_hsmmc_host *host = mmc_priv(mmc);
251 struct mmc_ios *ios = &mmc->ios; 251 struct mmc_ios *ios = &mmc->ios;
252 252
253 if (mmc->supply.vmmc) { 253 if (!IS_ERR(mmc->supply.vmmc)) {
254 ret = mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, ios->vdd); 254 ret = mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, ios->vdd);
255 if (ret) 255 if (ret)
256 return ret; 256 return ret;
257 } 257 }
258 258
259 /* Enable interface voltage rail, if needed */ 259 /* Enable interface voltage rail, if needed */
260 if (mmc->supply.vqmmc && !host->vqmmc_enabled) { 260 if (!IS_ERR(mmc->supply.vqmmc) && !host->vqmmc_enabled) {
261 ret = regulator_enable(mmc->supply.vqmmc); 261 ret = regulator_enable(mmc->supply.vqmmc);
262 if (ret) { 262 if (ret) {
263 dev_err(mmc_dev(mmc), "vmmc_aux reg enable failed\n"); 263 dev_err(mmc_dev(mmc), "vmmc_aux reg enable failed\n");
@@ -269,7 +269,7 @@ static int omap_hsmmc_enable_supply(struct mmc_host *mmc)
269 return 0; 269 return 0;
270 270
271err_vqmmc: 271err_vqmmc:
272 if (mmc->supply.vmmc) 272 if (!IS_ERR(mmc->supply.vmmc))
273 mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, 0); 273 mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, 0);
274 274
275 return ret; 275 return ret;
@@ -281,7 +281,7 @@ static int omap_hsmmc_disable_supply(struct mmc_host *mmc)
281 int status; 281 int status;
282 struct omap_hsmmc_host *host = mmc_priv(mmc); 282 struct omap_hsmmc_host *host = mmc_priv(mmc);
283 283
284 if (mmc->supply.vqmmc && host->vqmmc_enabled) { 284 if (!IS_ERR(mmc->supply.vqmmc) && host->vqmmc_enabled) {
285 ret = regulator_disable(mmc->supply.vqmmc); 285 ret = regulator_disable(mmc->supply.vqmmc);
286 if (ret) { 286 if (ret) {
287 dev_err(mmc_dev(mmc), "vmmc_aux reg disable failed\n"); 287 dev_err(mmc_dev(mmc), "vmmc_aux reg disable failed\n");
@@ -290,7 +290,7 @@ static int omap_hsmmc_disable_supply(struct mmc_host *mmc)
290 host->vqmmc_enabled = 0; 290 host->vqmmc_enabled = 0;
291 } 291 }
292 292
293 if (mmc->supply.vmmc) { 293 if (!IS_ERR(mmc->supply.vmmc)) {
294 ret = mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, 0); 294 ret = mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, 0);
295 if (ret) 295 if (ret)
296 goto err_set_ocr; 296 goto err_set_ocr;
@@ -299,7 +299,7 @@ static int omap_hsmmc_disable_supply(struct mmc_host *mmc)
299 return 0; 299 return 0;
300 300
301err_set_ocr: 301err_set_ocr:
302 if (mmc->supply.vqmmc) { 302 if (!IS_ERR(mmc->supply.vqmmc)) {
303 status = regulator_enable(mmc->supply.vqmmc); 303 status = regulator_enable(mmc->supply.vqmmc);
304 if (status) 304 if (status)
305 dev_err(mmc_dev(mmc), "vmmc_aux re-enable failed\n"); 305 dev_err(mmc_dev(mmc), "vmmc_aux re-enable failed\n");
@@ -313,7 +313,7 @@ static int omap_hsmmc_set_pbias(struct omap_hsmmc_host *host, bool power_on,
313{ 313{
314 int ret; 314 int ret;
315 315
316 if (!host->pbias) 316 if (IS_ERR(host->pbias))
317 return 0; 317 return 0;
318 318
319 if (power_on) { 319 if (power_on) {
@@ -363,7 +363,7 @@ static int omap_hsmmc_set_power(struct omap_hsmmc_host *host, int power_on,
363 * If we don't see a Vcc regulator, assume it's a fixed 363 * If we don't see a Vcc regulator, assume it's a fixed
364 * voltage always-on regulator. 364 * voltage always-on regulator.
365 */ 365 */
366 if (!mmc->supply.vmmc) 366 if (IS_ERR(mmc->supply.vmmc))
367 return 0; 367 return 0;
368 368
369 if (mmc_pdata(host)->before_set_reg) 369 if (mmc_pdata(host)->before_set_reg)
@@ -415,7 +415,7 @@ static int omap_hsmmc_disable_boot_regulator(struct regulator *reg)
415{ 415{
416 int ret; 416 int ret;
417 417
418 if (!reg) 418 if (IS_ERR(reg))
419 return 0; 419 return 0;
420 420
421 if (regulator_is_enabled(reg)) { 421 if (regulator_is_enabled(reg)) {
@@ -480,7 +480,6 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)
480 return ret; 480 return ret;
481 dev_dbg(host->dev, "unable to get vmmc regulator %ld\n", 481 dev_dbg(host->dev, "unable to get vmmc regulator %ld\n",
482 PTR_ERR(mmc->supply.vmmc)); 482 PTR_ERR(mmc->supply.vmmc));
483 mmc->supply.vmmc = NULL;
484 } else { 483 } else {
485 ocr_value = mmc_regulator_get_ocrmask(mmc->supply.vmmc); 484 ocr_value = mmc_regulator_get_ocrmask(mmc->supply.vmmc);
486 if (ocr_value > 0) 485 if (ocr_value > 0)
@@ -495,7 +494,6 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)
495 return ret; 494 return ret;
496 dev_dbg(host->dev, "unable to get vmmc_aux regulator %ld\n", 495 dev_dbg(host->dev, "unable to get vmmc_aux regulator %ld\n",
497 PTR_ERR(mmc->supply.vqmmc)); 496 PTR_ERR(mmc->supply.vqmmc));
498 mmc->supply.vqmmc = NULL;
499 } 497 }
500 498
501 host->pbias = devm_regulator_get_optional(host->dev, "pbias"); 499 host->pbias = devm_regulator_get_optional(host->dev, "pbias");
@@ -508,7 +506,6 @@ static int omap_hsmmc_reg_get(struct omap_hsmmc_host *host)
508 } 506 }
509 dev_dbg(host->dev, "unable to get pbias regulator %ld\n", 507 dev_dbg(host->dev, "unable to get pbias regulator %ld\n",
510 PTR_ERR(host->pbias)); 508 PTR_ERR(host->pbias));
511 host->pbias = NULL;
512 } 509 }
513 510
514 /* For eMMC do not power off when not in sleep state */ 511 /* For eMMC do not power off when not in sleep state */