From: Dan Carpenter <dan.carpenter@oracle.com>
To: thomas.petazzoni@bootlin.com
Cc: linux-gpio@vger.kernel.org
Subject: [bug report] mmc: sdhci: use WP GPIO in sdhci_check_ro()
Date: Tue, 27 Jul 2021 11:50:32 +0300 [thread overview]
Message-ID: <20210727085032.GA21268@kili> (raw)
Hello Thomas Petazzoni,
The patch 6d5cd068ee59: "mmc: sdhci: use WP GPIO in sdhci_check_ro()"
from Feb 12, 2019, leads to the following static checker warning:
drivers/gpio/gpiolib.c:3287 gpiod_get_value_cansleep()
warn: sleeping in atomic context
drivers/mmc/host/sdhci.c
2424 static int sdhci_check_ro(struct sdhci_host *host)
2425 {
2426 unsigned long flags;
2427 int is_readonly;
2428
2429 spin_lock_irqsave(&host->lock, flags);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
We're holding a spin lock.
2430
2431 if (host->flags & SDHCI_DEVICE_DEAD)
2432 is_readonly = 0;
2433 else if (host->ops->get_ro)
2434 is_readonly = host->ops->get_ro(host);
2435 else if (mmc_can_gpio_ro(host->mmc))
2436 is_readonly = mmc_gpio_get_ro(host->mmc);
^^^^^^^^^^^^^^^^^^^^^^^^^^
The mmc_gpio_get_ro() function calls gpiod_get_value_cansleep() which,
as the name suggests, can sleep.
2437 else
2438 is_readonly = !(sdhci_readl(host, SDHCI_PRESENT_STATE)
2439 & SDHCI_WRITE_PROTECT);
2440
2441 spin_unlock_irqrestore(&host->lock, flags);
2442
2443 /* This quirk needs to be replaced by a callback-function later */
2444 return host->quirks & SDHCI_QUIRK_INVERTED_WRITE_PROTECT ?
2445 !is_readonly : is_readonly;
2446 }
regards,
dan carpenter
reply other threads:[~2021-07-27 8:50 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20210727085032.GA21268@kili \
--to=dan.carpenter@oracle.com \
--cc=linux-gpio@vger.kernel.org \
--cc=thomas.petazzoni@bootlin.com \
/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).