mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Olivier MOYSAN <olivier.moysan@foss.st.com>
To: Johan Hovold <johan@kernel.org>,
	Arnaud Pouliquen <arnaud.pouliquen@foss.st.com>,
	Mark Brown <broonie@kernel.org>
Cc: Liam Girdwood <lgirdwood@gmail.com>,
	Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
	Maxime Coquelin <mcoquelin.stm32@gmail.com>,
	Alexandre Torgue <alexandre.torgue@foss.st.com>,
	<linux-sound@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<stable@vger.kernel.org>, Olivier Moysan <olivier.moysan@st.com>
Subject: Re: [PATCH 2/4] ASoC: stm32: sai: fix clk prepare imbalance on probe failure
Date: Tue, 25 Nov 2025 14:36:57 +0100	[thread overview]
Message-ID: <535d0468-f194-4e04-9f2b-ba27151d2672@foss.st.com> (raw)
In-Reply-To: <20251124104908.15754-3-johan@kernel.org>



On 11/24/25 11:49, Johan Hovold wrote:
> Make sure to unprepare the parent clock also on probe failures (e.g.
> probe deferral).
> 
> Fixes: a14bf98c045b ("ASoC: stm32: sai: fix possible circular locking")
> Cc: stable@vger.kernel.org	# 5.5
> Cc: Olivier Moysan <olivier.moysan@st.com>
> Signed-off-by: Johan Hovold <johan@kernel.org>

Reviewed-by: olivier moysan <olivier.moysan@foss.st.com>

Olivier

> ---
>   sound/soc/stm/stm32_sai_sub.c | 28 +++++++++++++++++++++-------
>   1 file changed, 21 insertions(+), 7 deletions(-)
> 
> diff --git a/sound/soc/stm/stm32_sai_sub.c b/sound/soc/stm/stm32_sai_sub.c
> index 0ae1eae2a59e..7a005b4ad304 100644
> --- a/sound/soc/stm/stm32_sai_sub.c
> +++ b/sound/soc/stm/stm32_sai_sub.c
> @@ -1634,14 +1634,21 @@ static int stm32_sai_sub_parse_of(struct platform_device *pdev,
>   	if (of_property_present(np, "#clock-cells")) {
>   		ret = stm32_sai_add_mclk_provider(sai);
>   		if (ret < 0)
> -			return ret;
> +			goto err_unprepare_pclk;
>   	} else {
>   		sai->sai_mclk = devm_clk_get_optional(&pdev->dev, "MCLK");
> -		if (IS_ERR(sai->sai_mclk))
> -			return PTR_ERR(sai->sai_mclk);
> +		if (IS_ERR(sai->sai_mclk)) {
> +			ret = PTR_ERR(sai->sai_mclk);
> +			goto err_unprepare_pclk;
> +		}
>   	}
>   
>   	return 0;
> +
> +err_unprepare_pclk:
> +	clk_unprepare(sai->pdata->pclk);
> +
> +	return ret;
>   }
>   
>   static int stm32_sai_sub_probe(struct platform_device *pdev)
> @@ -1688,26 +1695,33 @@ static int stm32_sai_sub_probe(struct platform_device *pdev)
>   			       IRQF_SHARED, dev_name(&pdev->dev), sai);
>   	if (ret) {
>   		dev_err(&pdev->dev, "IRQ request returned %d\n", ret);
> -		return ret;
> +		goto err_unprepare_pclk;
>   	}
>   
>   	if (STM_SAI_PROTOCOL_IS_SPDIF(sai))
>   		conf = &stm32_sai_pcm_config_spdif;
>   
>   	ret = snd_dmaengine_pcm_register(&pdev->dev, conf, 0);
> -	if (ret)
> -		return dev_err_probe(&pdev->dev, ret, "Could not register pcm dma\n");
> +	if (ret) {
> +		ret = dev_err_probe(&pdev->dev, ret, "Could not register pcm dma\n");
> +		goto err_unprepare_pclk;
> +	}
>   
>   	ret = snd_soc_register_component(&pdev->dev, &stm32_component,
>   					 &sai->cpu_dai_drv, 1);
>   	if (ret) {
>   		snd_dmaengine_pcm_unregister(&pdev->dev);
> -		return ret;
> +		goto err_unprepare_pclk;
>   	}
>   
>   	pm_runtime_enable(&pdev->dev);
>   
>   	return 0;
> +
> +err_unprepare_pclk:
> +	clk_unprepare(sai->pdata->pclk);
> +
> +	return ret;
>   }
>   
>   static void stm32_sai_sub_remove(struct platform_device *pdev)

  reply	other threads:[~2025-11-25 13:37 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-24 10:49 [PATCH 0/4] ASoC: stm32: sai: fix device and OF node leaks on probe Johan Hovold
2025-11-24 10:49 ` [PATCH 1/4] ASoC: stm32: sai: fix device leak " Johan Hovold
2025-11-25 13:36   ` Olivier MOYSAN
2025-11-24 10:49 ` [PATCH 2/4] ASoC: stm32: sai: fix clk prepare imbalance on probe failure Johan Hovold
2025-11-25 13:36   ` Olivier MOYSAN [this message]
2025-11-24 10:49 ` [PATCH 3/4] ASoC: stm32: sai: fix OF node leak on probe Johan Hovold
2025-11-25 13:37   ` Olivier MOYSAN
2025-11-24 10:49 ` [PATCH 4/4] ASoC: stm32: sai: clean up probe error path Johan Hovold
2025-11-25 13:37   ` Olivier MOYSAN
2025-11-25 19:22 ` [PATCH 0/4] ASoC: stm32: sai: fix device and OF node leaks on probe Mark Brown
2025-11-26 21:00   ` Gabor Juhos

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=535d0468-f194-4e04-9f2b-ba27151d2672@foss.st.com \
    --to=olivier.moysan@foss.st.com \
    --cc=alexandre.torgue@foss.st.com \
    --cc=arnaud.pouliquen@foss.st.com \
    --cc=broonie@kernel.org \
    --cc=johan@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=olivier.moysan@st.com \
    --cc=perex@perex.cz \
    --cc=stable@vger.kernel.org \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®