Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mmc: sdhci-msm: pervent access to suspended controller

Generic sdhci code registers LED device and uses host->runtime_suspended
flag to protect access to it. The sdhci-msm driver doesn't set this flag,
which causes a crash when LED is accessed while controller is runtime
suspended. Fix this by setting the flag correctly.

Cc: stable@vger.kernel.org
Fixes: 67e6db113c90 ("mmc: sdhci-msm: Add pm_runtime and system PM support")
Signed-off-by: Mantas Pucka <mantas@8devices.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Link: https://lore.kernel.org/r/20240321-sdhci-mmc-suspend-v1-1-fbc555a64400@8devices.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>

authored by

Mantas Pucka and committed by
Ulf Hansson
f8def10f 39cd87c4

+15 -1
+15 -1
drivers/mmc/host/sdhci-msm.c
··· 2694 2694 struct sdhci_host *host = dev_get_drvdata(dev); 2695 2695 struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); 2696 2696 struct sdhci_msm_host *msm_host = sdhci_pltfm_priv(pltfm_host); 2697 + unsigned long flags; 2698 + 2699 + spin_lock_irqsave(&host->lock, flags); 2700 + host->runtime_suspended = true; 2701 + spin_unlock_irqrestore(&host->lock, flags); 2697 2702 2698 2703 /* Drop the performance vote */ 2699 2704 dev_pm_opp_set_rate(dev, 0); ··· 2713 2708 struct sdhci_host *host = dev_get_drvdata(dev); 2714 2709 struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); 2715 2710 struct sdhci_msm_host *msm_host = sdhci_pltfm_priv(pltfm_host); 2711 + unsigned long flags; 2716 2712 int ret; 2717 2713 2718 2714 ret = clk_bulk_prepare_enable(ARRAY_SIZE(msm_host->bulk_clks), ··· 2732 2726 2733 2727 dev_pm_opp_set_rate(dev, msm_host->clk_rate); 2734 2728 2735 - return sdhci_msm_ice_resume(msm_host); 2729 + ret = sdhci_msm_ice_resume(msm_host); 2730 + if (ret) 2731 + return ret; 2732 + 2733 + spin_lock_irqsave(&host->lock, flags); 2734 + host->runtime_suspended = false; 2735 + spin_unlock_irqrestore(&host->lock, flags); 2736 + 2737 + return ret; 2736 2738 } 2737 2739 2738 2740 static const struct dev_pm_ops sdhci_msm_pm_ops = {