Skip to contentSkip to conversation

FAILED: patch "[PATCH] mmc: mtk-sd: Fix missing clk_disable_unprepare in" failed to apply to 5.15-stable tree

PATCH [email protected] 1 participant 1 message Dec 3, 2022

Subsystems (4)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch below does not apply to the 5.15-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

Possible dependencies:

c61bfb1cb63d ("mmc: mtk-sd: Fix missing clk_disable_unprepare in msdc_of_clock_parse()")

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From c61bfb1cb63ddab52b31cf5f1924688917e61fad Mon Sep 17 00:00:00 2001
From: Gaosheng Cui <[email protected]>
Date: Fri, 25 Nov 2022 17:01:41 +0800
Subject: [PATCH] mmc: mtk-sd: Fix missing clk_disable_unprepare in
msdc_of_clock_parse()

The clk_disable_unprepare() should be called in the error handling of devm_clk_bulk_get_optional, fix it by replacing devm_clk_get_optional and clk_prepare_enable by devm_clk_get_optional_enabled.

Fixes f5eccd94b63f ("mmc: mediatek: Add subsys clock control for MT8192 msdc")
drivers/mmc/host/mtk-sd.c +2 -4
index df941438aef5..26bc59b5a7cc 100644
@@ -2588,13 +2588,11 @@ static int msdc_of_clock_parse(struct platform_device *pdev,
 			return PTR_ERR(host->src_clk_cg);
 	}
 
-	host->sys_clk_cg = devm_clk_get_optional(&pdev->dev, "sys_cg");
+	/* If present, always enable for this clock gate */
+	host->sys_clk_cg = devm_clk_get_optional_enabled(&pdev->dev, "sys_cg");
 	if (IS_ERR(host->sys_clk_cg))
 		host->sys_clk_cg = NULL;
 
-	/* If present, always enable for this clock gate */
-	clk_prepare_enable(host->sys_clk_cg);
-
 	host->bulk_clks[0].id = "pclk_cg";
 	host->bulk_clks[1].id = "axi_cg";
 	host->bulk_clks[2].id = "ahb_cg";