linux-mmc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Veerabhadrarao Badiganti <vbadigan@codeaurora.org>
To: dan.carpenter@oracle.com, vviswana@codeaurora.org
Cc: linux-mmc@vger.kernel.org
Subject: Re: [bug report] mmc: sdhci: Allow platform controlled voltage switching
Date: Thu, 9 Jul 2020 15:31:51 +0530	[thread overview]
Message-ID: <d4c802c3-ac84-b27d-53b8-fcaa109f622c@codeaurora.org> (raw)
In-Reply-To: <20200709094338.GA17926@mwanda>

Hi,

Thanks for reporting this issue. Will post a patch to fix this issue.

Thanks
Veera

On 7/9/2020 3:13 PM, dan.carpenter@oracle.com wrote:
> 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

      reply	other threads:[~2020-07-09 10:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-09  9:43 [bug report] mmc: sdhci: Allow platform controlled voltage switching dan.carpenter
2020-07-09 10:01 ` Veerabhadrarao Badiganti [this message]

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=d4c802c3-ac84-b27d-53b8-fcaa109f622c@codeaurora.org \
    --to=vbadigan@codeaurora.org \
    --cc=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;
as well as URLs for NNTP newsgroup(s).