diff options
author | venu byravarasu <vbyravarasu@nvidia.com> | 2011-06-02 15:37:17 +0530 |
---|---|---|
committer | Niket Sirsi <nsirsi@nvidia.com> | 2011-06-03 14:40:24 -0700 |
commit | af40c45da8352a1ebdb543d2efb48d87c41e50ec (patch) | |
tree | 5b3462b29a6ab815f3060e02bfcac8882bbb6709 /drivers/mmc | |
parent | 8ea6fe3ef507a686fccf1eb24064210c00ccf099 (diff) |
sdhci: tegra: error handling for invalid regulator
When regulator is not available, SDHCI is crashing during suspend.
Hence explicitly setting the regulator pointer to NULL, so that
no further regulator operations are done, if regulator_get() fails.
bug 829405
Change-Id: I7cd3f8029e4dc9116267033b2a3f560608513b16
Reviewed-on: http://git-master/r/34874
Tested-by: Venu Byravarasu <vbyravarasu@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Reviewed-by: Pavan Kunapuli <pkunapuli@nvidia.com>
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
Diffstat (limited to 'drivers/mmc')
-rw-r--r-- | drivers/mmc/host/sdhci-tegra.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/mmc/host/sdhci-tegra.c b/drivers/mmc/host/sdhci-tegra.c index 994e54874fd8..e5a2e5a21f51 100644 --- a/drivers/mmc/host/sdhci-tegra.c +++ b/drivers/mmc/host/sdhci-tegra.c @@ -307,12 +307,14 @@ static int __devinit tegra_sdhci_probe(struct platform_device *pdev) dev_info(&pdev->dev, "get slot power rail regulator\n"); if (host->reg_vdd_slot == NULL) { host->reg_vdd_slot = regulator_get(NULL, plat->slot_rail_name); - if (WARN_ON(IS_ERR_OR_NULL(host->reg_vdd_slot))) + if (WARN_ON(IS_ERR_OR_NULL(host->reg_vdd_slot))) { dev_err(&pdev->dev, "couldn't get regulator " "%s: %ld\n", plat->slot_rail_name, PTR_ERR(host->reg_vdd_slot)); - else + host->reg_vdd_slot = NULL; + } else { regulator_enable(host->reg_vdd_slot); + } } } else host->reg_vdd_slot = NULL; @@ -322,11 +324,12 @@ static int __devinit tegra_sdhci_probe(struct platform_device *pdev) dev_info(&pdev->dev, "Getting regulator for rail %s\n", plat->vdd_rail_name); if (host->reg_vddio == NULL) { host->reg_vddio = regulator_get(NULL, plat->vdd_rail_name); - if (WARN_ON(IS_ERR_OR_NULL(host->reg_vddio))) + if (WARN_ON(IS_ERR_OR_NULL(host->reg_vddio))) { dev_err(&pdev->dev, "couldn't get regulator " "%s: %ld\n", plat->vdd_rail_name, PTR_ERR(host->reg_vddio)); - else { + host->reg_vddio = NULL; + } else { rc = regulator_set_voltage(host->reg_vddio, plat->vdd_min_uv, plat->vdd_max_uv); if (rc != 0) { |