sound/soc/intel/boards/bytcr_rt5640.c | 1 + sound/soc/intel/boards/bytcr_rt5651.c | 3 ++- sound/soc/intel/boards/cht_bsw_rt5672.c | 4 +++- 3 files changed, 6 insertions(+), 2 deletions(-)
From: Aravind Anilraj <aravindanilraj0702@gmail.com>
In three Intel ASoC board drivers, the EVENT_ON path in
platform_clock_control() enables MCLK via clk_prepare_enable() but fails
to call clk_disable_unprepare() on subsequent error paths, leaking the
clock reference.
Fix this across all three affected drivers.
Aravind Anilraj (3):
ASoC: Intel: bytcr_rt5640: Fix MCLK leak on platform_clock_control
error
ASoC: Intel: bytcr_rt5651: Fix MCLK leak on platform_clock_control
error
ASoC: Intel: cht_bsw_rt5672: Fix MCLK leak in platform_clock_control
sound/soc/intel/boards/bytcr_rt5640.c | 1 +
sound/soc/intel/boards/bytcr_rt5651.c | 3 ++-
sound/soc/intel/boards/cht_bsw_rt5672.c | 4 +++-
3 files changed, 6 insertions(+), 2 deletions(-)
--
2.47.3
From: Aravind Anilraj <aravindanilraj0702@gmail.com>
In three Intel ASoC board drivers, the EVENT_ON path in
platform_clock_control() enables MCLK using clk_prepare_enable(), but
error paths fail to call clk_disable_unprepare(), leaking a clock
reference.
Fix this by calling a clk_disable_unprepare() on error paths after MCLK
has been enabled.
v2: Guard clk_disable_unprepare() with SND_SOC_DAPM_EVENT_ON() to avoid
callling it in the EVENT_OFF error path where MCLK was never enabled.
v3: Restored missing clk_disable_unprepare() guard in patch 2 that
was accidentally dropped during v2 rebase.
Aravind Anilraj (3):
ASoC: Intel: bytcr_rt5640: Fix MCLK leak on platform_clock_control
error
ASoC: Intel: bytcr_rt5651: Fix MCLK leak on platform_clock_control
error
ASoC: Intel: cht_bsw_rt5672: Fix MCLK leak in platform_clock_control
sound/soc/intel/boards/bytcr_rt5640.c | 2 ++
sound/soc/intel/boards/bytcr_rt5651.c | 4 +++-
sound/soc/intel/boards/cht_bsw_rt5672.c | 4 +++-
3 files changed, 8 insertions(+), 2 deletions(-)
--
2.47.3
On Fri, Mar 27, 2026 at 05:04:05PM -0400, aravindanilraj0702@gmail.com wrote: > From: Aravind Anilraj <aravindanilraj0702@gmail.com> > > In three Intel ASoC board drivers, the EVENT_ON path in > platform_clock_control() enables MCLK using clk_prepare_enable(), but > error paths fail to call clk_disable_unprepare(), leaking a clock > reference. Please don't send new patches in reply to old patches or serieses, this makes it harder for both people and tools to understand what is going on - it can bury things in mailboxes and make it difficult to keep track of what current patches are, both for the new patches and the old ones. Please don't ignore review comments, people are generally making them for a reason and are likely to have the same concerns if issues remain unaddressed. Having to repeat the same comments can get repetitive and make people question the value of time spent reviewing. If you disagree with the review comments that's fine but you need to reply and discuss your concerns so that the reviewer can understand your decisions.
Hi Mark, Thanks for the feedback. Apologies for the confusion — I sent multiple revisions in quick succession and incorrectly threaded the newer version as a reply to the earlier series. I understand this makes tracking harder. In v4, I have: Split unrelated changes into a separate patch Added return codes to dev_err() messages as suggested I will send future revisions as a new thread instead of replying to older series. Thanks for the review. Regards, Aravind On Sat, Mar 28, 2026 at 2:36 AM Mark Brown <broonie@kernel.org> wrote: > > On Fri, Mar 27, 2026 at 05:04:05PM -0400, aravindanilraj0702@gmail.com wrote: > > From: Aravind Anilraj <aravindanilraj0702@gmail.com> > > > > In three Intel ASoC board drivers, the EVENT_ON path in > > platform_clock_control() enables MCLK using clk_prepare_enable(), but > > error paths fail to call clk_disable_unprepare(), leaking a clock > > reference. > > Please don't send new patches in reply to old patches or serieses, this > makes it harder for both people and tools to understand what is going > on - it can bury things in mailboxes and make it difficult to keep track > of what current patches are, both for the new patches and the old ones. > > Please don't ignore review comments, people are generally making them > for a reason and are likely to have the same concerns if issues remain > unaddressed. Having to repeat the same comments can get repetitive and > make people question the value of time spent reviewing. If you disagree > with the review comments that's fine but you need to reply and discuss > your concerns so that the reviewer can understand your decisions.
From: Aravind Anilraj <aravindanilraj0702@gmail.com>
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@gmail.com>
---
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);
return ret;
}
--
2.47.3
From: Aravind Anilraj <aravindanilraj0702@gmail.com>
If byt_rt5651_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@gmail.com>
---
sound/soc/intel/boards/bytcr_rt5651.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/sound/soc/intel/boards/bytcr_rt5651.c b/sound/soc/intel/boards/bytcr_rt5651.c
index 68cf463f1d50..65944eb4be16 100644
--- a/sound/soc/intel/boards/bytcr_rt5651.c
+++ b/sound/soc/intel/boards/bytcr_rt5651.c
@@ -205,7 +205,7 @@ static int platform_clock_control(struct snd_soc_dapm_widget *w,
if (SND_SOC_DAPM_EVENT_ON(event)) {
ret = clk_prepare_enable(priv->mclk);
if (ret < 0) {
- dev_err(card->dev, "could not configure MCLK state");
+ dev_err(card->dev, "could not configure MCLK state\n");
return ret;
}
ret = byt_rt5651_prepare_and_enable_pll1(codec_dai, 48000, 50);
@@ -224,6 +224,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);
return ret;
}
--
2.47.3
From: Aravind Anilraj <aravindanilraj0702@gmail.com>
If snd_soc_dai_set_pll() or snd_soc_dai_set_sysclk() fail inside the
EVENT_ON path, the function returns without calling
clk_disable_unprepare() on ctx->mclk, which was already enabled earlier
in the same code path. Add the missing clk_disable_unprepare() calls
before returning the error.
Signed-off-by: Aravind Anilraj <aravindanilraj0702@gmail.com>
---
sound/soc/intel/boards/cht_bsw_rt5672.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/sound/soc/intel/boards/cht_bsw_rt5672.c b/sound/soc/intel/boards/cht_bsw_rt5672.c
index 359723f2700e..e5806dc16ff9 100644
--- a/sound/soc/intel/boards/cht_bsw_rt5672.c
+++ b/sound/soc/intel/boards/cht_bsw_rt5672.c
@@ -67,7 +67,7 @@ static int platform_clock_control(struct snd_soc_dapm_widget *w,
ret = clk_prepare_enable(ctx->mclk);
if (ret < 0) {
dev_err(card->dev,
- "could not configure MCLK state");
+ "could not configure MCLK state\n");
return ret;
}
}
@@ -77,6 +77,7 @@ static int platform_clock_control(struct snd_soc_dapm_widget *w,
CHT_PLAT_CLK_3_HZ, 48000 * 512);
if (ret < 0) {
dev_err(card->dev, "can't set codec pll: %d\n", ret);
+ clk_disable_unprepare(ctx->mclk);
return ret;
}
@@ -85,6 +86,7 @@ static int platform_clock_control(struct snd_soc_dapm_widget *w,
48000 * 512, SND_SOC_CLOCK_IN);
if (ret < 0) {
dev_err(card->dev, "can't set codec sysclk: %d\n", ret);
+ clk_disable_unprepare(ctx->mclk);
return ret;
}
} else {
--
2.47.3
From: Aravind Anilraj <aravindanilraj0702@gmail.com>
In three Intel ASoC board drivers, the EVENT_ON path in
platform_clock_control() enables MCLK using clk_prepare_enable(), but
error paths fail to call clk_disable_unprepare(), leaking a clock
reference.
Fix this by calling a clk_disable_unprepare() on error paths after MCLK
has been enabled.
v2: Guard clk_disable_unprepare() with SND_SOC_DAPM_EVENT_ON() to avoid
callling it in the EVENT_OFF error path where MCLK was never enabled.
Aravind Anilraj (3):
ASoC: Intel: bytcr_rt5640: Fix MCLK leak on platform_clock_control
error
ASoC: Intel: bytcr_rt5651: Fix MCLK leak on platform_clock_control
error
ASoC: Intel: cht_bsw_rt5672: Fix MCLK leak in platform_clock_control
sound/soc/intel/boards/bytcr_rt5640.c | 2 ++
sound/soc/intel/boards/bytcr_rt5651.c | 2 +-
sound/soc/intel/boards/cht_bsw_rt5672.c | 4 +++-
3 files changed, 6 insertions(+), 2 deletions(-)
--
2.47.3
From: Aravind Anilraj <aravindanilraj0702@gmail.com>
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@gmail.com>
---
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);
return ret;
}
--
2.47.3
From: Aravind Anilraj <aravindanilraj0702@gmail.com>
If byt_rt5651_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@gmail.com>
---
sound/soc/intel/boards/bytcr_rt5651.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/intel/boards/bytcr_rt5651.c b/sound/soc/intel/boards/bytcr_rt5651.c
index 68cf463f1d50..9f19eb483c69 100644
--- a/sound/soc/intel/boards/bytcr_rt5651.c
+++ b/sound/soc/intel/boards/bytcr_rt5651.c
@@ -205,7 +205,7 @@ static int platform_clock_control(struct snd_soc_dapm_widget *w,
if (SND_SOC_DAPM_EVENT_ON(event)) {
ret = clk_prepare_enable(priv->mclk);
if (ret < 0) {
- dev_err(card->dev, "could not configure MCLK state");
+ dev_err(card->dev, "could not configure MCLK state\n");
return ret;
}
ret = byt_rt5651_prepare_and_enable_pll1(codec_dai, 48000, 50);
--
2.47.3
From: Aravind Anilraj <aravindanilraj0702@gmail.com>
If snd_soc_dai_set_pll() or snd_soc_dai_set_sysclk() fail inside the
EVENT_ON path, the function returns without calling
clk_disable_unprepare() on ctx->mclk, which was already enabled earlier
in the same code path. Add the missing clk_disable_unprepare() calls
before returning the error.
Signed-off-by: Aravind Anilraj <aravindanilraj0702@gmail.com>
---
sound/soc/intel/boards/cht_bsw_rt5672.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/sound/soc/intel/boards/cht_bsw_rt5672.c b/sound/soc/intel/boards/cht_bsw_rt5672.c
index 359723f2700e..e5806dc16ff9 100644
--- a/sound/soc/intel/boards/cht_bsw_rt5672.c
+++ b/sound/soc/intel/boards/cht_bsw_rt5672.c
@@ -67,7 +67,7 @@ static int platform_clock_control(struct snd_soc_dapm_widget *w,
ret = clk_prepare_enable(ctx->mclk);
if (ret < 0) {
dev_err(card->dev,
- "could not configure MCLK state");
+ "could not configure MCLK state\n");
return ret;
}
}
@@ -77,6 +77,7 @@ static int platform_clock_control(struct snd_soc_dapm_widget *w,
CHT_PLAT_CLK_3_HZ, 48000 * 512);
if (ret < 0) {
dev_err(card->dev, "can't set codec pll: %d\n", ret);
+ clk_disable_unprepare(ctx->mclk);
return ret;
}
@@ -85,6 +86,7 @@ static int platform_clock_control(struct snd_soc_dapm_widget *w,
48000 * 512, SND_SOC_CLOCK_IN);
if (ret < 0) {
dev_err(card->dev, "can't set codec sysclk: %d\n", ret);
+ clk_disable_unprepare(ctx->mclk);
return ret;
}
} else {
--
2.47.3
© 2016 - 2026 Red Hat, Inc.