答复: [PATCH -next] ASoC: stm: Fix PM disable depth imbalance in stm32_i2s_probe

zhangqilong zhangqilong3 at huawei.com
Mon Sep 26 16:24:14 CEST 2022


> 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 at 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


More information about the Alsa-devel mailing list