* [PATCH 0/3] ASoC: Intel: Fix MCLK leaks in
@ 2026-03-27 19:29 aravindanilraj0702
2026-03-27 19:30 ` [PATCH 1/3] ASoC: Intel: bytcr_rt5640: Fix MCLK leak on platform_clock_control error aravindanilraj0702
` (5 more replies)
0 siblings, 6 replies; 17+ messages in thread
From: aravindanilraj0702 @ 2026-03-27 19:29 UTC (permalink / raw)
To: broonie, linux-sound
Cc: cezary.rojewski, liam.r.girdwood, peter.ujfalusi, yung-chuan.liao,
ranjani.sridharan, kai.vehmanen, pierre-louis.bossart, perex,
tiwai, linux-kernel, Aravind Anilraj
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
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 1/3] ASoC: Intel: bytcr_rt5640: Fix MCLK leak on platform_clock_control error
2026-03-27 19:29 [PATCH 0/3] ASoC: Intel: Fix MCLK leaks in aravindanilraj0702
@ 2026-03-27 19:30 ` aravindanilraj0702
2026-03-27 19:30 ` [PATCH 2/3] ASoC: Intel: bytcr_rt5651: " aravindanilraj0702
` (4 subsequent siblings)
5 siblings, 0 replies; 17+ messages in thread
From: aravindanilraj0702 @ 2026-03-27 19:30 UTC (permalink / raw)
To: broonie, linux-sound
Cc: cezary.rojewski, liam.r.girdwood, peter.ujfalusi, yung-chuan.liao,
ranjani.sridharan, kai.vehmanen, pierre-louis.bossart, perex,
tiwai, linux-kernel, Aravind Anilraj
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 | 1 +
1 file changed, 1 insertion(+)
diff --git a/sound/soc/intel/boards/bytcr_rt5640.c b/sound/soc/intel/boards/bytcr_rt5640.c
index 103e0b445603..3ecfba161e56 100644
--- a/sound/soc/intel/boards/bytcr_rt5640.c
+++ b/sound/soc/intel/boards/bytcr_rt5640.c
@@ -304,6 +304,7 @@ 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);
+ clk_disable_unprepare(priv->mclk);
return ret;
}
--
2.47.3
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 2/3] ASoC: Intel: bytcr_rt5651: Fix MCLK leak on platform_clock_control error
2026-03-27 19:29 [PATCH 0/3] ASoC: Intel: Fix MCLK leaks in aravindanilraj0702
2026-03-27 19:30 ` [PATCH 1/3] ASoC: Intel: bytcr_rt5640: Fix MCLK leak on platform_clock_control error aravindanilraj0702
@ 2026-03-27 19:30 ` aravindanilraj0702
2026-03-27 20:10 ` Mark Brown
2026-03-27 19:30 ` [PATCH 3/3] ASoC: Intel: cht_bsw_rt5672: Fix MCLK leak in platform_clock_control aravindanilraj0702
` (3 subsequent siblings)
5 siblings, 1 reply; 17+ messages in thread
From: aravindanilraj0702 @ 2026-03-27 19:30 UTC (permalink / raw)
To: broonie, linux-sound
Cc: cezary.rojewski, liam.r.girdwood, peter.ujfalusi, yung-chuan.liao,
ranjani.sridharan, kai.vehmanen, pierre-louis.bossart, perex,
tiwai, linux-kernel, Aravind Anilraj
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 | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/sound/soc/intel/boards/bytcr_rt5651.c b/sound/soc/intel/boards/bytcr_rt5651.c
index 68cf463f1d50..2eef9a6dc8f3 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,7 @@ 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);
+ clk_disable_unprepare(priv->mclk);
return ret;
}
--
2.47.3
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 3/3] ASoC: Intel: cht_bsw_rt5672: Fix MCLK leak in platform_clock_control
2026-03-27 19:29 [PATCH 0/3] ASoC: Intel: Fix MCLK leaks in aravindanilraj0702
2026-03-27 19:30 ` [PATCH 1/3] ASoC: Intel: bytcr_rt5640: Fix MCLK leak on platform_clock_control error aravindanilraj0702
2026-03-27 19:30 ` [PATCH 2/3] ASoC: Intel: bytcr_rt5651: " aravindanilraj0702
@ 2026-03-27 19:30 ` aravindanilraj0702
2026-03-27 20:11 ` Mark Brown
2026-03-27 20:13 ` [PATCH v2 0/3] ASoC: Intel: Fix MCLK leaks in aravindanilraj0702
` (2 subsequent siblings)
5 siblings, 1 reply; 17+ messages in thread
From: aravindanilraj0702 @ 2026-03-27 19:30 UTC (permalink / raw)
To: broonie, linux-sound
Cc: cezary.rojewski, liam.r.girdwood, peter.ujfalusi, yung-chuan.liao,
ranjani.sridharan, kai.vehmanen, pierre-louis.bossart, perex,
tiwai, linux-kernel, Aravind Anilraj
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
^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH 2/3] ASoC: Intel: bytcr_rt5651: Fix MCLK leak on platform_clock_control error
2026-03-27 19:30 ` [PATCH 2/3] ASoC: Intel: bytcr_rt5651: " aravindanilraj0702
@ 2026-03-27 20:10 ` Mark Brown
0 siblings, 0 replies; 17+ messages in thread
From: Mark Brown @ 2026-03-27 20:10 UTC (permalink / raw)
To: aravindanilraj0702
Cc: linux-sound, cezary.rojewski, liam.r.girdwood, peter.ujfalusi,
yung-chuan.liao, ranjani.sridharan, kai.vehmanen,
pierre-louis.bossart, perex, tiwai, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 965 bytes --]
On Fri, Mar 27, 2026 at 03:30:01PM -0400, aravindanilraj0702@gmail.com wrote:
> 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.
The changelog does not mention this...
> 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);
...separate change which is unrelated and really should be a separate
patch as covered in submitting-patches.rst.
It's a good enough change, ideally we'd log the return code as well.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 3/3] ASoC: Intel: cht_bsw_rt5672: Fix MCLK leak in platform_clock_control
2026-03-27 19:30 ` [PATCH 3/3] ASoC: Intel: cht_bsw_rt5672: Fix MCLK leak in platform_clock_control aravindanilraj0702
@ 2026-03-27 20:11 ` Mark Brown
0 siblings, 0 replies; 17+ messages in thread
From: Mark Brown @ 2026-03-27 20:11 UTC (permalink / raw)
To: aravindanilraj0702
Cc: linux-sound, cezary.rojewski, liam.r.girdwood, peter.ujfalusi,
yung-chuan.liao, ranjani.sridharan, kai.vehmanen,
pierre-louis.bossart, perex, tiwai, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 309 bytes --]
On Fri, Mar 27, 2026 at 03:30:02PM -0400, aravindanilraj0702@gmail.com wrote:
> 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;
> }
> }
Same thing here.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH v2 0/3] ASoC: Intel: Fix MCLK leaks in
2026-03-27 19:29 [PATCH 0/3] ASoC: Intel: Fix MCLK leaks in aravindanilraj0702
` (2 preceding siblings ...)
2026-03-27 19:30 ` [PATCH 3/3] ASoC: Intel: cht_bsw_rt5672: Fix MCLK leak in platform_clock_control aravindanilraj0702
@ 2026-03-27 20:13 ` aravindanilraj0702
2026-03-27 20:13 ` [PATCH v2 1/3] ASoC: Intel: bytcr_rt5640: Fix MCLK leak on platform_clock_control error aravindanilraj0702
` (2 more replies)
2026-03-27 21:04 ` [PATCH v3 0/3] ASoC: Intel: Fix MCLK leaks " aravindanilraj0702
2026-04-09 22:03 ` [PATCH 0/3] ASoC: Intel: Fix MCLK leaks in Mark Brown
5 siblings, 3 replies; 17+ messages in thread
From: aravindanilraj0702 @ 2026-03-27 20:13 UTC (permalink / raw)
To: broonie, linux-sound
Cc: cezary.rojewski, liam.r.girdwood, peter.ujfalusi, yung-chuan.liao,
ranjani.sridharan, kai.vehmanen, pierre-louis.bossart, perex,
tiwai, linux-kernel, Aravind Anilraj
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
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH v2 1/3] ASoC: Intel: bytcr_rt5640: Fix MCLK leak on platform_clock_control error
2026-03-27 20:13 ` [PATCH v2 0/3] ASoC: Intel: Fix MCLK leaks in aravindanilraj0702
@ 2026-03-27 20:13 ` aravindanilraj0702
2026-03-27 20:13 ` [PATCH v2 2/3] ASoC: Intel: bytcr_rt5651: " aravindanilraj0702
2026-03-27 20:13 ` [PATCH v2 3/3] ASoC: Intel: cht_bsw_rt5672: Fix MCLK leak in platform_clock_control aravindanilraj0702
2 siblings, 0 replies; 17+ messages in thread
From: aravindanilraj0702 @ 2026-03-27 20:13 UTC (permalink / raw)
To: broonie, linux-sound
Cc: cezary.rojewski, liam.r.girdwood, peter.ujfalusi, yung-chuan.liao,
ranjani.sridharan, kai.vehmanen, pierre-louis.bossart, perex,
tiwai, linux-kernel, Aravind Anilraj
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
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH v2 2/3] ASoC: Intel: bytcr_rt5651: Fix MCLK leak on platform_clock_control error
2026-03-27 20:13 ` [PATCH v2 0/3] ASoC: Intel: Fix MCLK leaks in aravindanilraj0702
2026-03-27 20:13 ` [PATCH v2 1/3] ASoC: Intel: bytcr_rt5640: Fix MCLK leak on platform_clock_control error aravindanilraj0702
@ 2026-03-27 20:13 ` aravindanilraj0702
2026-03-27 20:13 ` [PATCH v2 3/3] ASoC: Intel: cht_bsw_rt5672: Fix MCLK leak in platform_clock_control aravindanilraj0702
2 siblings, 0 replies; 17+ messages in thread
From: aravindanilraj0702 @ 2026-03-27 20:13 UTC (permalink / raw)
To: broonie, linux-sound
Cc: cezary.rojewski, liam.r.girdwood, peter.ujfalusi, yung-chuan.liao,
ranjani.sridharan, kai.vehmanen, pierre-louis.bossart, perex,
tiwai, linux-kernel, Aravind Anilraj
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
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH v2 3/3] ASoC: Intel: cht_bsw_rt5672: Fix MCLK leak in platform_clock_control
2026-03-27 20:13 ` [PATCH v2 0/3] ASoC: Intel: Fix MCLK leaks in aravindanilraj0702
2026-03-27 20:13 ` [PATCH v2 1/3] ASoC: Intel: bytcr_rt5640: Fix MCLK leak on platform_clock_control error aravindanilraj0702
2026-03-27 20:13 ` [PATCH v2 2/3] ASoC: Intel: bytcr_rt5651: " aravindanilraj0702
@ 2026-03-27 20:13 ` aravindanilraj0702
2 siblings, 0 replies; 17+ messages in thread
From: aravindanilraj0702 @ 2026-03-27 20:13 UTC (permalink / raw)
To: broonie, linux-sound
Cc: cezary.rojewski, liam.r.girdwood, peter.ujfalusi, yung-chuan.liao,
ranjani.sridharan, kai.vehmanen, pierre-louis.bossart, perex,
tiwai, linux-kernel, Aravind Anilraj
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
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH v3 0/3] ASoC: Intel: Fix MCLK leaks in platform_clock_control
2026-03-27 19:29 [PATCH 0/3] ASoC: Intel: Fix MCLK leaks in aravindanilraj0702
` (3 preceding siblings ...)
2026-03-27 20:13 ` [PATCH v2 0/3] ASoC: Intel: Fix MCLK leaks in aravindanilraj0702
@ 2026-03-27 21:04 ` aravindanilraj0702
2026-03-27 21:04 ` [PATCH v3 1/3] ASoC: Intel: bytcr_rt5640: Fix MCLK leak on platform_clock_control error aravindanilraj0702
` (3 more replies)
2026-04-09 22:03 ` [PATCH 0/3] ASoC: Intel: Fix MCLK leaks in Mark Brown
5 siblings, 4 replies; 17+ messages in thread
From: aravindanilraj0702 @ 2026-03-27 21:04 UTC (permalink / raw)
To: broonie, linux-sound
Cc: cezary.rojewski, liam.r.girdwood, peter.ujfalusi, yung-chuan.liao,
ranjani.sridharan, kai.vehmanen, pierre-louis.bossart, perex,
tiwai, linux-kernel, Aravind Anilraj
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
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH v3 1/3] ASoC: Intel: bytcr_rt5640: Fix MCLK leak on platform_clock_control error
2026-03-27 21:04 ` [PATCH v3 0/3] ASoC: Intel: Fix MCLK leaks " aravindanilraj0702
@ 2026-03-27 21:04 ` aravindanilraj0702
2026-03-27 21:04 ` [PATCH v3 2/3] ASoC: Intel: bytcr_rt5651: " aravindanilraj0702
` (2 subsequent siblings)
3 siblings, 0 replies; 17+ messages in thread
From: aravindanilraj0702 @ 2026-03-27 21:04 UTC (permalink / raw)
To: broonie, linux-sound
Cc: cezary.rojewski, liam.r.girdwood, peter.ujfalusi, yung-chuan.liao,
ranjani.sridharan, kai.vehmanen, pierre-louis.bossart, perex,
tiwai, linux-kernel, Aravind Anilraj
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
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH v3 2/3] ASoC: Intel: bytcr_rt5651: Fix MCLK leak on platform_clock_control error
2026-03-27 21:04 ` [PATCH v3 0/3] ASoC: Intel: Fix MCLK leaks " aravindanilraj0702
2026-03-27 21:04 ` [PATCH v3 1/3] ASoC: Intel: bytcr_rt5640: Fix MCLK leak on platform_clock_control error aravindanilraj0702
@ 2026-03-27 21:04 ` aravindanilraj0702
2026-03-27 21:04 ` [PATCH v3 3/3] ASoC: Intel: cht_bsw_rt5672: Fix MCLK leak in platform_clock_control aravindanilraj0702
2026-03-27 21:06 ` [PATCH v3 0/3] ASoC: Intel: Fix MCLK leaks " Mark Brown
3 siblings, 0 replies; 17+ messages in thread
From: aravindanilraj0702 @ 2026-03-27 21:04 UTC (permalink / raw)
To: broonie, linux-sound
Cc: cezary.rojewski, liam.r.girdwood, peter.ujfalusi, yung-chuan.liao,
ranjani.sridharan, kai.vehmanen, pierre-louis.bossart, perex,
tiwai, linux-kernel, Aravind Anilraj
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
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH v3 3/3] ASoC: Intel: cht_bsw_rt5672: Fix MCLK leak in platform_clock_control
2026-03-27 21:04 ` [PATCH v3 0/3] ASoC: Intel: Fix MCLK leaks " aravindanilraj0702
2026-03-27 21:04 ` [PATCH v3 1/3] ASoC: Intel: bytcr_rt5640: Fix MCLK leak on platform_clock_control error aravindanilraj0702
2026-03-27 21:04 ` [PATCH v3 2/3] ASoC: Intel: bytcr_rt5651: " aravindanilraj0702
@ 2026-03-27 21:04 ` aravindanilraj0702
2026-03-27 21:06 ` [PATCH v3 0/3] ASoC: Intel: Fix MCLK leaks " Mark Brown
3 siblings, 0 replies; 17+ messages in thread
From: aravindanilraj0702 @ 2026-03-27 21:04 UTC (permalink / raw)
To: broonie, linux-sound
Cc: cezary.rojewski, liam.r.girdwood, peter.ujfalusi, yung-chuan.liao,
ranjani.sridharan, kai.vehmanen, pierre-louis.bossart, perex,
tiwai, linux-kernel, Aravind Anilraj
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
^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH v3 0/3] ASoC: Intel: Fix MCLK leaks in platform_clock_control
2026-03-27 21:04 ` [PATCH v3 0/3] ASoC: Intel: Fix MCLK leaks " aravindanilraj0702
` (2 preceding siblings ...)
2026-03-27 21:04 ` [PATCH v3 3/3] ASoC: Intel: cht_bsw_rt5672: Fix MCLK leak in platform_clock_control aravindanilraj0702
@ 2026-03-27 21:06 ` Mark Brown
2026-03-28 6:19 ` Aravind
3 siblings, 1 reply; 17+ messages in thread
From: Mark Brown @ 2026-03-27 21:06 UTC (permalink / raw)
To: aravindanilraj0702
Cc: linux-sound, cezary.rojewski, liam.r.girdwood, peter.ujfalusi,
yung-chuan.liao, ranjani.sridharan, kai.vehmanen,
pierre-louis.bossart, perex, tiwai, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1078 bytes --]
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.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v3 0/3] ASoC: Intel: Fix MCLK leaks in platform_clock_control
2026-03-27 21:06 ` [PATCH v3 0/3] ASoC: Intel: Fix MCLK leaks " Mark Brown
@ 2026-03-28 6:19 ` Aravind
0 siblings, 0 replies; 17+ messages in thread
From: Aravind @ 2026-03-28 6:19 UTC (permalink / raw)
To: Mark Brown
Cc: linux-sound, cezary.rojewski, liam.r.girdwood, peter.ujfalusi,
yung-chuan.liao, ranjani.sridharan, kai.vehmanen,
pierre-louis.bossart, perex, tiwai, linux-kernel
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.
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 0/3] ASoC: Intel: Fix MCLK leaks in
2026-03-27 19:29 [PATCH 0/3] ASoC: Intel: Fix MCLK leaks in aravindanilraj0702
` (4 preceding siblings ...)
2026-03-27 21:04 ` [PATCH v3 0/3] ASoC: Intel: Fix MCLK leaks " aravindanilraj0702
@ 2026-04-09 22:03 ` Mark Brown
5 siblings, 0 replies; 17+ messages in thread
From: Mark Brown @ 2026-04-09 22:03 UTC (permalink / raw)
To: linux-sound, aravindanilraj0702
Cc: cezary.rojewski, liam.r.girdwood, peter.ujfalusi, yung-chuan.liao,
ranjani.sridharan, kai.vehmanen, pierre-louis.bossart, perex,
tiwai, linux-kernel
On Fri, 27 Mar 2026 15:29:59 -0400, aravindanilraj0702@gmail.com wrote:
> 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.
>
> [...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/3] ASoC: Intel: bytcr_rt5640: Fix MCLK leak on platform_clock_control error
https://git.kernel.org/broonie/misc/c/a02496a29463
[2/3] ASoC: Intel: bytcr_rt5651: Fix MCLK leak on platform_clock_control error
https://git.kernel.org/broonie/misc/c/b022e5c142ef
[3/3] ASoC: Intel: cht_bsw_rt5672: Fix MCLK leak in platform_clock_control
(no commit info)
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2026-04-09 22:03 UTC | newest]
Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-27 19:29 [PATCH 0/3] ASoC: Intel: Fix MCLK leaks in aravindanilraj0702
2026-03-27 19:30 ` [PATCH 1/3] ASoC: Intel: bytcr_rt5640: Fix MCLK leak on platform_clock_control error aravindanilraj0702
2026-03-27 19:30 ` [PATCH 2/3] ASoC: Intel: bytcr_rt5651: " aravindanilraj0702
2026-03-27 20:10 ` Mark Brown
2026-03-27 19:30 ` [PATCH 3/3] ASoC: Intel: cht_bsw_rt5672: Fix MCLK leak in platform_clock_control aravindanilraj0702
2026-03-27 20:11 ` Mark Brown
2026-03-27 20:13 ` [PATCH v2 0/3] ASoC: Intel: Fix MCLK leaks in aravindanilraj0702
2026-03-27 20:13 ` [PATCH v2 1/3] ASoC: Intel: bytcr_rt5640: Fix MCLK leak on platform_clock_control error aravindanilraj0702
2026-03-27 20:13 ` [PATCH v2 2/3] ASoC: Intel: bytcr_rt5651: " aravindanilraj0702
2026-03-27 20:13 ` [PATCH v2 3/3] ASoC: Intel: cht_bsw_rt5672: Fix MCLK leak in platform_clock_control aravindanilraj0702
2026-03-27 21:04 ` [PATCH v3 0/3] ASoC: Intel: Fix MCLK leaks " aravindanilraj0702
2026-03-27 21:04 ` [PATCH v3 1/3] ASoC: Intel: bytcr_rt5640: Fix MCLK leak on platform_clock_control error aravindanilraj0702
2026-03-27 21:04 ` [PATCH v3 2/3] ASoC: Intel: bytcr_rt5651: " aravindanilraj0702
2026-03-27 21:04 ` [PATCH v3 3/3] ASoC: Intel: cht_bsw_rt5672: Fix MCLK leak in platform_clock_control aravindanilraj0702
2026-03-27 21:06 ` [PATCH v3 0/3] ASoC: Intel: Fix MCLK leaks " Mark Brown
2026-03-28 6:19 ` Aravind
2026-04-09 22:03 ` [PATCH 0/3] ASoC: Intel: Fix MCLK leaks in Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox