Patch "mmc: mtk-sd: Fix error handle of probe function" has been added to the 6.6-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    mmc: mtk-sd: Fix error handle of probe function

to the 6.6-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     mmc-mtk-sd-fix-error-handle-of-probe-function.patch
and it can be found in the queue-6.6 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 61788dcf2b34924a0af024bf09b4d506d3d16e7b
Author: Andy-ld Lu <andy-ld.lu@xxxxxxxxxxxx>
Date:   Thu Nov 7 20:11:21 2024 +0800

    mmc: mtk-sd: Fix error handle of probe function
    
    [ Upstream commit 291220451c775a054cedc4fab4578a1419eb6256 ]
    
    In the probe function, it goes to 'release_mem' label and returns after
    some procedure failure. But if the clocks (partial or all) have been
    enabled previously, they would not be disabled in msdc_runtime_suspend,
    since runtime PM is not yet enabled for this case.
    
    That cause mmc related clocks always on during system suspend and block
    suspend flow. Below log is from a SDCard issue of MT8196 chromebook, it
    returns -ETIMEOUT while polling clock stable in the msdc_ungate_clock()
    and probe failed, but the enabled clocks could not be disabled anyway.
    
    [  129.059253] clk_chk_dev_pm_suspend()
    [  129.350119] suspend warning: msdcpll is on
    [  129.354494] [ck_msdc30_1_sel : enabled, 1, 1, 191999939,   ck_msdcpll_d2]
    [  129.362787] [ck_msdcpll_d2   : enabled, 1, 1, 191999939,         msdcpll]
    [  129.371041] [ck_msdc30_1_ck  : enabled, 1, 1, 191999939, ck_msdc30_1_sel]
    [  129.379295] [msdcpll         : enabled, 1, 1, 383999878,          clk26m]
    
    Add a new 'release_clk' label and reorder the error handle functions to
    make sure the clocks be disabled after probe failure.
    
    Fixes: ffaea6ebfe9c ("mmc: mtk-sd: Use readl_poll_timeout instead of open-coded polling")
    Fixes: 7a2fa8eed936 ("mmc: mtk-sd: use devm_mmc_alloc_host")
    Signed-off-by: Andy-ld Lu <andy-ld.lu@xxxxxxxxxxxx>
    Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@xxxxxxxxxxxxx>
    Cc: stable@xxxxxxxxxxxxxxx
    Message-ID: <20241107121215.5201-1-andy-ld.lu@xxxxxxxxxxxx>
    Signed-off-by: Ulf Hansson <ulf.hansson@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/mmc/host/mtk-sd.c b/drivers/mmc/host/mtk-sd.c
index 9ebf5aa5d9b18..a97034388cdff 100644
--- a/drivers/mmc/host/mtk-sd.c
+++ b/drivers/mmc/host/mtk-sd.c
@@ -2813,7 +2813,7 @@ static int msdc_drv_probe(struct platform_device *pdev)
 	ret = msdc_ungate_clock(host);
 	if (ret) {
 		dev_err(&pdev->dev, "Cannot ungate clocks!\n");
-		goto release_mem;
+		goto release_clk;
 	}
 	msdc_init_hw(host);
 
@@ -2823,14 +2823,14 @@ static int msdc_drv_probe(struct platform_device *pdev)
 					     GFP_KERNEL);
 		if (!host->cq_host) {
 			ret = -ENOMEM;
-			goto release_mem;
+			goto release;
 		}
 		host->cq_host->caps |= CQHCI_TASK_DESC_SZ_128;
 		host->cq_host->mmio = host->base + 0x800;
 		host->cq_host->ops = &msdc_cmdq_ops;
 		ret = cqhci_init(host->cq_host, mmc, true);
 		if (ret)
-			goto release_mem;
+			goto release;
 		mmc->max_segs = 128;
 		/* cqhci 16bit length */
 		/* 0 size, means 65536 so we don't have to -1 here */
@@ -2857,9 +2857,10 @@ static int msdc_drv_probe(struct platform_device *pdev)
 end:
 	pm_runtime_disable(host->dev);
 release:
-	platform_set_drvdata(pdev, NULL);
 	msdc_deinit_hw(host);
+release_clk:
 	msdc_gate_clock(host);
+	platform_set_drvdata(pdev, NULL);
 release_mem:
 	if (host->dma.gpd)
 		dma_free_coherent(&pdev->dev,




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux