From: Adrian Hunter <adrian.hunter@xxxxxxxxx> commit ab069ce125965a5e282f7b53b86aee76ab32975c upstream. sdhci_check_ro() can call mmc_gpio_get_ro() while holding the sdhci host->lock spinlock. That would be a problem if the GPIO access done by mmc_gpio_get_ro() needed to sleep. However, host->lock is not needed anyway. The mmc core ensures that host operations do not race with each other, and asynchronous callbacks like the interrupt handler, software timeouts, completion work etc, cannot affect sdhci_check_ro(). So remove the locking. Fixes: 6d5cd068ee59 ("mmc: sdhci: use WP GPIO in sdhci_check_ro()") Signed-off-by: Adrian Hunter <adrian.hunter@xxxxxxxxx> Cc: stable@xxxxxxxxxxxxxxx Link: https://lore.kernel.org/r/20240614080051.4005-3-adrian.hunter@xxxxxxxxx Signed-off-by: Ulf Hansson <ulf.hansson@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/mmc/host/sdhci.c | 5 ----- 1 file changed, 5 deletions(-) --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -2493,11 +2493,8 @@ static int sdhci_get_cd(struct mmc_host static int sdhci_check_ro(struct sdhci_host *host) { bool allow_invert = false; - unsigned long flags; int is_readonly; - spin_lock_irqsave(&host->lock, flags); - if (host->flags & SDHCI_DEVICE_DEAD) { is_readonly = 0; } else if (host->ops->get_ro) { @@ -2512,8 +2509,6 @@ static int sdhci_check_ro(struct sdhci_h allow_invert = true; } - spin_unlock_irqrestore(&host->lock, flags); - if (is_readonly >= 0 && allow_invert && (host->quirks & SDHCI_QUIRK_INVERTED_WRITE_PROTECT)) Patches currently in stable-queue which might be from adrian.hunter@xxxxxxxxx are queue-5.10/mmc-sdhci-change-the-code-to-check-auto_cmd23.patch queue-5.10/mmc-core-capture-emmc-and-sd-card-errors.patch queue-5.10/mmc-sdhci-do-not-lock-spinlock-around-mmc_gpio_get_ro.patch queue-5.10/mmc-host-factor-out-clearing-the-retune-state.patch queue-5.10/mmc-core-only-print-retune-error-when-we-don-t-check.patch queue-5.10/mmc-sdhci-capture-emmc-and-sd-card-errors.patch queue-5.10/mmc-sdhci-do-not-invert-write-protect-twice.patch queue-5.10/mmc-sdhci-pci-convert-pcibios_-return-codes-to-errnos.patch queue-5.10/mmc-sdhci-add-support-for-tuning-error-interrupts.patch