* [PATCH -next] ASoC: stm: Fix PM disable depth imbalance in stm32_i2s_probe
@ 2022-09-26 9:14 Zhang Qilong
2022-09-26 12:52 ` Arnaud POULIQUEN
0 siblings, 1 reply; 3+ messages in thread
From: Zhang Qilong @ 2022-09-26 9:14 UTC (permalink / raw)
To: olivier.moysan, arnaud.pouliquen, perex, tiwai, mcoquelin.stm32,
alexandre.torgue
Cc: alsa-devel, linux-stm32
The pm_runtime_enable will increase power disable depth. Thus
a pairing decrement is needed on the error handling path to
keep it balanced according to context.
Fixes:efc162cbd480f ("ASoC: stm: Use dev_err_probe() helper")
Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com>
---
sound/soc/stm/stm32_i2s.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/sound/soc/stm/stm32_i2s.c b/sound/soc/stm/stm32_i2s.c
index 6aafe793eec4..5a717443b105 100644
--- a/sound/soc/stm/stm32_i2s.c
+++ b/sound/soc/stm/stm32_i2s.c
@@ -1139,12 +1139,15 @@ static int stm32_i2s_probe(struct platform_device *pdev)
pm_runtime_enable(&pdev->dev);
ret = snd_dmaengine_pcm_register(&pdev->dev, &stm32_i2s_pcm_config, 0);
- if (ret)
+ if (ret) {
+ pm_runtime_disable(&pdev->dev);
return dev_err_probe(&pdev->dev, ret, "PCM DMA register error\n");
+ }
ret = snd_soc_register_component(&pdev->dev, &stm32_i2s_component,
i2s->dai_drv, 1);
if (ret) {
+ pm_runtime_disable(&pdev->dev);
snd_dmaengine_pcm_unregister(&pdev->dev);
return ret;
}
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH -next] ASoC: stm: Fix PM disable depth imbalance in stm32_i2s_probe
2022-09-26 9:14 [PATCH -next] ASoC: stm: Fix PM disable depth imbalance in stm32_i2s_probe Zhang Qilong
@ 2022-09-26 12:52 ` Arnaud POULIQUEN
2022-09-26 14:24 ` 答复: " zhangqilong
0 siblings, 1 reply; 3+ messages in thread
From: Arnaud POULIQUEN @ 2022-09-26 12:52 UTC (permalink / raw)
To: Zhang Qilong, olivier.moysan, perex, tiwai, mcoquelin.stm32,
alexandre.torgue
Cc: alsa-devel, linux-stm32
Hello Zhang,
On 9/26/22 11:14, Zhang Qilong wrote:
> The pm_runtime_enable will increase power disable depth. Thus
> a pairing decrement is needed on the error handling path to
> keep it balanced according to context.
>
> Fixes:efc162cbd480f ("ASoC: stm: Use dev_err_probe() helper")
> Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com>
> ---
> sound/soc/stm/stm32_i2s.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/sound/soc/stm/stm32_i2s.c b/sound/soc/stm/stm32_i2s.c
> index 6aafe793eec4..5a717443b105 100644
> --- a/sound/soc/stm/stm32_i2s.c
> +++ b/sound/soc/stm/stm32_i2s.c
> @@ -1139,12 +1139,15 @@ static int stm32_i2s_probe(struct platform_device *pdev)
> pm_runtime_enable(&pdev->dev);
>
> ret = snd_dmaengine_pcm_register(&pdev->dev, &stm32_i2s_pcm_config, 0);
> - if (ret)
> + if (ret) {
> + pm_runtime_disable(&pdev->dev);
> return dev_err_probe(&pdev->dev, ret, "PCM DMA register error\n");
> + }
>
> ret = snd_soc_register_component(&pdev->dev, &stm32_i2s_component,
> i2s->dai_drv, 1);
> if (ret) {
> + pm_runtime_disable(&pdev->dev);
> snd_dmaengine_pcm_unregister(&pdev->dev);
> return ret;
> }
Seems that there the error has been introduced in this commit:
32a956a1fadf ("ASoC: stm32: i2s: add pm_runtime support")
The pm_runtime_enable should be at the end of the stm32_i2s_probe as done here:
https://github.com/STMicroelectronics/linux/blob/v5.15-stm32mp/sound/soc/stm/stm32_i2s.c#L1200
Please, could you update your patch in this way?
With also an update of the "Fixes:" reference in the commit message
Thanks,
Arnaud
^ permalink raw reply [flat|nested] 3+ messages in thread* 答复: [PATCH -next] ASoC: stm: Fix PM disable depth imbalance in stm32_i2s_probe
2022-09-26 12:52 ` Arnaud POULIQUEN
@ 2022-09-26 14:24 ` zhangqilong
0 siblings, 0 replies; 3+ messages in thread
From: zhangqilong @ 2022-09-26 14:24 UTC (permalink / raw)
To: Arnaud POULIQUEN, olivier.moysan@foss.st.com, perex@perex.cz,
tiwai@suse.com, mcoquelin.stm32@gmail.com,
alexandre.torgue@foss.st.com
Cc: alsa-devel@alsa-project.org,
linux-stm32@st-md-mailman.stormreply.com
> Hello Zhang,
>
> On 9/26/22 11:14, Zhang Qilong wrote:
> > The pm_runtime_enable will increase power disable depth. Thus a
> > pairing decrement is needed on the error handling path to keep it
> > balanced according to context.
> >
> > Fixes:efc162cbd480f ("ASoC: stm: Use dev_err_probe() helper")
> > Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com>
> > ---
> > sound/soc/stm/stm32_i2s.c | 5 ++++-
> > 1 file changed, 4 insertions(+), 1 deletion(-)
> >
> > diff --git a/sound/soc/stm/stm32_i2s.c b/sound/soc/stm/stm32_i2s.c
> > index 6aafe793eec4..5a717443b105 100644
> > --- a/sound/soc/stm/stm32_i2s.c
> > +++ b/sound/soc/stm/stm32_i2s.c
> > @@ -1139,12 +1139,15 @@ static int stm32_i2s_probe(struct
> platform_device *pdev)
> > pm_runtime_enable(&pdev->dev);
> >
> > ret = snd_dmaengine_pcm_register(&pdev->dev,
> &stm32_i2s_pcm_config, 0);
> > - if (ret)
> > + if (ret) {
> > + pm_runtime_disable(&pdev->dev);
> > return dev_err_probe(&pdev->dev, ret, "PCM DMA register
> error\n");
> > + }
> >
> > ret = snd_soc_register_component(&pdev->dev,
> &stm32_i2s_component,
> > i2s->dai_drv, 1);
> > if (ret) {
> > + pm_runtime_disable(&pdev->dev);
> > snd_dmaengine_pcm_unregister(&pdev->dev);
> > return ret;
> > }
>
> Seems that there the error has been introduced in this commit:
> 32a956a1fadf ("ASoC: stm32: i2s: add pm_runtime support") The
> pm_runtime_enable should be at the end of the stm32_i2s_probe as
> done here:
> https://github.com/STMicroelectronics/linux/blob/v5.15-stm32mp/sound/
> soc/stm/stm32_i2s.c#L1200
>
> Please, could you update your patch in this way?
> With also an update of the "Fixes:" reference in the commit message
Hi,
Very useful guide, and I have send v2 version. In addition, I found several similar problems at the same time and fixed it through a patch set.
Thanks,
Zhang
>
> Thanks,
> Arnaud
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-09-26 14:25 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-26 9:14 [PATCH -next] ASoC: stm: Fix PM disable depth imbalance in stm32_i2s_probe Zhang Qilong
2022-09-26 12:52 ` Arnaud POULIQUEN
2022-09-26 14:24 ` 答复: " zhangqilong
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox