From: <dan.carpenter@oracle.com>
To: vviswana@codeaurora.org
Cc: linux-mmc@vger.kernel.org
Subject: [bug report] mmc: sdhci: Allow platform controlled voltage switching
Date: Thu, 9 Jul 2020 12:43:38 +0300 [thread overview]
Message-ID: <20200709094338.GA17926@mwanda> (raw)
Hello Vijay Viswanath,
The patch f870b6d480d3: "mmc: sdhci: Allow platform controlled
voltage switching" from Jun 23, 2020, leads to the following static
checker warning:
drivers/mmc/host/sdhci.c:4396 sdhci_setup_host()
warn: potential ERR_PTR parameter dereference 'mmc->supply.vqmmc'
drivers/mmc/host/sdhci.c
4375 if (host->caps & SDHCI_CAN_DO_HISPD)
4376 mmc->caps |= MMC_CAP_SD_HIGHSPEED | MMC_CAP_MMC_HIGHSPEED;
4377
4378 if ((host->quirks & SDHCI_QUIRK_BROKEN_CARD_DETECTION) &&
4379 mmc_card_is_removable(mmc) &&
4380 mmc_gpio_get_cd(host->mmc) < 0)
4381 mmc->caps |= MMC_CAP_NEEDS_POLL;
4382
4383 if (!IS_ERR(mmc->supply.vqmmc)) {
4384 if (enable_vqmmc) {
4385 ret = regulator_enable(mmc->supply.vqmmc);
4386 if (ret) {
4387 pr_warn("%s: Failed to enable vqmmc regulator: %d\n",
4388 mmc_hostname(mmc), ret);
4389 mmc->supply.vqmmc = ERR_PTR(-EINVAL);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This is an error pointer.
4390 }
4391 host->sdhci_core_to_disable_vqmmc = !ret;
4392 }
4393
4394 /* If vqmmc provides no 1.8V signalling, then there's no UHS */
4395 if (!regulator_is_supported_voltage(mmc->supply.vqmmc, 1700000,
^^^^^^^^^^^^^^^^^
It is dereferenced inside the function and will crash.
4396 1950000))
4397 host->caps1 &= ~(SDHCI_SUPPORT_SDR104 |
4398 SDHCI_SUPPORT_SDR50 |
4399 SDHCI_SUPPORT_DDR50);
4400
4401 /* In eMMC case vqmmc might be a fixed 1.8V regulator */
4402 if (!regulator_is_supported_voltage(mmc->supply.vqmmc, 2700000,
4403 3600000))
4404 host->flags &= ~SDHCI_SIGNALING_330;
4405 }
4406
regards,
dan carpenter
next reply other threads:[~2020-07-09 9:43 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-09 9:43 dan.carpenter [this message]
2020-07-09 10:01 ` [bug report] mmc: sdhci: Allow platform controlled voltage switching Veerabhadrarao Badiganti
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=20200709094338.GA17926@mwanda \
--to=dan.carpenter@oracle.com \
--cc=linux-mmc@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox