Re: [PATCH] mmc: sdhci-sprd: disable runtime PM on remove
From: Ulf Hansson
Date: Mon Sep 28 2026 - 12:14:46 EST
On Tue, Sep 15, 2026 at 6:31 PM Guangshuo Li <lgs201920130244@xxxxxxxxx> wrote:
>
> sdhci_sprd_probe() enables runtime PM, while sdhci_sprd_remove() does
> not perform the corresponding runtime PM cleanup.
>
> The probe failure path disables runtime PM before disabling the clocks,
> but the normal remove path directly disables clocks that are also
> managed by the runtime PM callbacks. If the device is runtime
> suspended, those clocks may already be disabled.
>
> Resume the device before removal, disable runtime PM and drop the
> temporary runtime PM reference before disabling the clocks.
>
> This issue was found by manual code inspection.
>
> Fixes: fb8bd90f83c4 ("mmc: sdhci-sprd: Add Spreadtrum's initial host controller")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Guangshuo Li <lgs201920130244@xxxxxxxxx>
Applied for fixes, thanks!
Kind regards
Uffe
> ---
> drivers/mmc/host/sdhci-sprd.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/mmc/host/sdhci-sprd.c b/drivers/mmc/host/sdhci-sprd.c
> index 3584a2b314a9..0c8f389fe584 100644
> --- a/drivers/mmc/host/sdhci-sprd.c
> +++ b/drivers/mmc/host/sdhci-sprd.c
> @@ -890,6 +890,10 @@ static void sdhci_sprd_remove(struct platform_device *pdev)
> struct sdhci_host *host = platform_get_drvdata(pdev);
> struct sdhci_sprd_host *sprd_host = TO_SPRD_HOST(host);
>
> + pm_runtime_get_sync(&pdev->dev);
> + pm_runtime_disable(&pdev->dev);
> + pm_runtime_put_noidle(&pdev->dev);
> +
> sdhci_remove_host(host, 0);
>
> clk_disable_unprepare(sprd_host->clk_sdio);
> --
> 2.43.0
>