Hi,
Yes, I agree with you. We should check the error code of
devm_snd_soc_register_component() and do corresponding
handling.
Christophe JAILLET <christophe.jaillet@xxxxxxxxxx> 于2022年4月3日周日 13:51写道:
Le 07/03/2022 à 09:45, Miaoqian Lin a écrit :
Fix the missing clk_disable_unprepare() before returnb/sound/soc/codecs/msm8916-wcd-digital.c
from msm8916_wcd_digital_probe in the error handling case.
Fixes: 150db8c5afa1 ("ASoC: codecs: Add msm8916-wcd digital codec")
Signed-off-by: Miaoqian Lin <linmq006@xxxxxxxxx>
---
sound/soc/codecs/msm8916-wcd-digital.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/sound/soc/codecs/msm8916-wcd-digital.c
index fcc10c8bc625..9ad7fc0baf07 100644platform_device *pdev)
--- a/sound/soc/codecs/msm8916-wcd-digital.c
+++ b/sound/soc/codecs/msm8916-wcd-digital.c
@@ -1201,7 +1201,7 @@ static int msm8916_wcd_digital_probe(struct
ret = clk_prepare_enable(priv->mclk);platform_device *pdev)
if (ret < 0) {
dev_err(dev, "failed to enable mclk %d\n", ret);
- return ret;
+ goto err_clk;
}
dev_set_drvdata(dev, priv);
@@ -1209,6 +1209,9 @@ static int msm8916_wcd_digital_probe(struct
return devm_snd_soc_register_component(dev, &msm8916_wcd_digital,
msm8916_wcd_digital_dai,
ARRAY_SIZE(msm8916_wcd_digital_dai));
+err_clk:
+ clk_disable_unprepare(priv->ahbclk);
+ return ret;
}
static int msm8916_wcd_digital_remove(struct platform_device *pdev)
Hi,
I think that the same should be done for 'priv->mclk' if
devm_snd_soc_register_component() returns an error.
Can you give it a look?
CJ