From: Veerabhadrarao Badiganti <vbadigan@codeaurora.org>
To: adrian.hunter@intel.com, ulf.hansson@linaro.org,
dan.carpenter@oracle.com
Cc: linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-msm@vger.kernel.org,
Veerabhadrarao Badiganti <vbadigan@codeaurora.org>,
Vijay Viswanath <vviswana@codeaurora.org>
Subject: [PATCH V1] mmc: sdhci: Fix potential null pointer access while accessing vqmmc
Date: Thu, 9 Jul 2020 18:43:25 +0530 [thread overview]
Message-ID: <1594300408-17658-1-git-send-email-vbadigan@codeaurora.org> (raw)
Don't access vqmmc regulator handler, if it's already invalidated.
Fixes: f870b6d480d3 (mmc: sdhci: Allow platform controlled voltage switching)
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Veerabhadrarao Badiganti <vbadigan@codeaurora.org>
---
drivers/mmc/host/sdhci.c | 12 +++++++-----
1 file 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) {
--
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc., is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
next reply other threads:[~2020-07-09 13:13 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-09 13:13 Veerabhadrarao Badiganti [this message]
2020-07-10 7:58 ` [PATCH V1] mmc: sdhci: Fix potential null pointer access while accessing vqmmc Ulf Hansson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1594300408-17658-1-git-send-email-vbadigan@codeaurora.org \
--to=vbadigan@codeaurora.org \
--cc=adrian.hunter@intel.com \
--cc=dan.carpenter@oracle.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=ulf.hansson@linaro.org \
--cc=vviswana@codeaurora.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.