Re: [PATCH] ASoC: Intel: bytcr_wm5102: Fix MCLK leak on platform_clock_control error

Hans de Goede
2026-04-28T08:35:16Z

Hi,

On 28-Apr-26 04:38, Cássio Gabriel wrote:
> If byt_wm5102_prepare_and_enable_pll1() fails in the
> SND_SOC_DAPM_EVENT_ON() path, platform_clock_control() returns after
> clk_prepare_enable(priv->mclk) without disabling the clock again.
>
> This leaks an MCLK enable reference on failed power-up attempts. Add the
> missing clk_disable_unprepare() on the error path, matching the unwind
> used by the other Intel platform_clock_control() implementations.
>
> Fixes: 9a87fc1e0619 ("ASoC: Intel: bytcr_wm5102: Add machine driver for BYT/WM5102")
> Cc: stable@vger.kernel.org
> Signed-off-by: Cássio Gabriel <cassiogabrielcontato@gmail.com>

Thanks, patch looks good to me:

Reviewed-by: Hans de Goede <johannes.goede@oss.qualcomm.com>

As Andy noted there are other drivers under sound/soc/intel/boards/
which can likely benefit from a similar fix.

Regards,

Hans

> ---
> sound/soc/intel/boards/bytcr_wm5102.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/sound/soc/intel/boards/bytcr_wm5102.c b/sound/soc/intel/boards/bytcr_wm5102.c
> index 4879f79aef29..4aa0cf49b033 100644
> --- a/sound/soc/intel/boards/bytcr_wm5102.c
> +++ b/sound/soc/intel/boards/bytcr_wm5102.c
> @@ -170,6 +170,7 @@ static int platform_clock_control(struct snd_soc_dapm_widget *w,
> ret = byt_wm5102_prepare_and_enable_pll1(codec_dai, 48000);
> if (ret) {
> dev_err(card->dev, "Error setting codec sysclk: %d\n", ret);
> + clk_disable_unprepare(priv->mclk);
> return ret;
> }
> } else {
>
> ---
> base-commit: 98421d94a1a6dcc3e8582eb62bedeccecda93339
> change-id: 20260427-bytcr-wm5102-mclk-leak-88016072a63c
>
> Best regards,
> --
> Cássio Gabriel <cassiogabrielcontato@gmail.com>
>