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

Zhang Qilong zhangqilong3 at huawei.com
Mon Sep 26 11:14:39 CEST 2022


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;
 	}
-- 
2.25.1



More information about the Alsa-devel mailing list