Re: [PATCH v4 1/4] ASoC: Intel: bytcr_rt5640: Fix MCLK leak on platform_clock_control error
From: Cezary Rojewski
Date: Mon Mar 30 2026 - 04:27:36 EST
On 2026-03-28 6:25 AM, aravindanilraj0702@xxxxxxxxx wrote:
From: Aravind Anilraj <aravindanilraj0702@xxxxxxxxx>
If byt_rt5640_prepare_and_enable_pll1() fails, the function returns
without calling clk_disable_unprepare() on priv->mclk, which was
already enabled earlier in the same code path. Add the missing
clk_disable_unprepare() call before returning the error.
Signed-off-by: Aravind Anilraj <aravindanilraj0702@xxxxxxxxx>
---
sound/soc/intel/boards/bytcr_rt5640.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/sound/soc/intel/boards/bytcr_rt5640.c b/sound/soc/intel/boards/bytcr_rt5640.c
index 103e0b445603..fce726a9c8c0 100644
--- a/sound/soc/intel/boards/bytcr_rt5640.c
+++ b/sound/soc/intel/boards/bytcr_rt5640.c
@@ -304,6 +304,8 @@ static int platform_clock_control(struct snd_soc_dapm_widget *w,
if (ret < 0) {
dev_err(card->dev, "can't set codec sysclk: %d\n", ret);
+ if (SND_SOC_DAPM_EVENT_ON(event))
+ clk_disable_unprepare(priv->mclk);
This if-statement complicates the situation unnecessarily. Please do the check in scope of "if (SND_SOC_DAPM_EVENT_ON(event))" found earlier in this function.
return ret;
}