aboutsummaryrefslogtreecommitdiff
path: root/drivers/mmc
diff options
context:
space:
mode:
authorVeerabhadrarao Badiganti2020-07-09 18:43:25 +0530
committerUlf Hansson2020-07-13 12:18:26 +0200
commit3debc24f7fe637ebefbaa3d37aeecb33a69bde11 (patch)
treea23cf01719ea360c9ab5b214ff292189a2535c74 /drivers/mmc
parentec02760b63c21c439d44956e9c66d0af24011f03 (diff)
mmc: sdhci: Fix potential null pointer access while accessing vqmmc
Don't access vqmmc regulator handler, if it's already invalidated. Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Veerabhadrarao Badiganti <vbadigan@codeaurora.org> Link: https://lore.kernel.org/r/1594300408-17658-1-git-send-email-vbadigan@codeaurora.org Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Diffstat (limited to 'drivers/mmc')
-rw-r--r--drivers/mmc/host/sdhci.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index e6275c2202b0..d3b62fc5c661 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -4383,11 +4383,6 @@ int sdhci_setup_host(struct sdhci_host *host)
if (!IS_ERR(mmc->supply.vqmmc)) {
if (enable_vqmmc) {
ret = regulator_enable(mmc->supply.vqmmc);
- if (ret) {
- pr_warn("%s: Failed to enable vqmmc regulator: %d\n",
- mmc_hostname(mmc), ret);
- mmc->supply.vqmmc = ERR_PTR(-EINVAL);
- }
host->sdhci_core_to_disable_vqmmc = !ret;
}
@@ -4402,6 +4397,13 @@ int sdhci_setup_host(struct sdhci_host *host)
if (!regulator_is_supported_voltage(mmc->supply.vqmmc, 2700000,
3600000))
host->flags &= ~SDHCI_SIGNALING_330;
+
+ if (ret) {
+ pr_warn("%s: Failed to enable vqmmc regulator: %d\n",
+ mmc_hostname(mmc), ret);
+ mmc->supply.vqmmc = ERR_PTR(-EINVAL);
+ }
+
}
if (host->quirks2 & SDHCI_QUIRK2_NO_1_8_V) {