Skip to contentSkip to conversation

ASoC: msm8916-wcd-digital: Fix missing clk_disable_unprepare() in msm8916_wcd_digital_probe

PATCH In review Miaoqian Lin 3 participants 5 messages Mar 7, 2022 – Apr 3, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ASoC: msm8916-wcd-digital: Fix missing clk_disable_unprepare() in msm8916_wcd_digital_probe

Fix the missing clk_disable_unprepare() before return from msm8916_wcd_digital_probe in the error handling case.

Fixes 150db8c5afa1 ("ASoC: codecs: Add msm8916-wcd digital codec")
---
 sound/soc/codecs/msm8916-wcd-digital.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
sound/soc/codecs/msm8916-wcd-digital.c +4 -1
index fcc10c8bc625..9ad7fc0baf07 100644
@@ -1201,7 +1201,7 @@ static int msm8916_wcd_digital_probe(struct platform_device *pdev)
 	ret = clk_prepare_enable(priv->mclk);
 	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 platform_device *pdev)
 	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)
Signature · 1 line
2.17.1
maintainer
#1 lore raw
Quoted 4 lines · Miaoqian Lin

Fix the missing clk_disable_unprepare() before return from msm8916_wcd_digital_probe in the error handling case.

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] ASoC: msm8916-wcd-digital: Fix missing clk_disable_unprepare() in msm8916_wcd_digital_probe

      commit: 375a347da4889f64d86e1ab7f4e6702b6e9bf299

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark

#2 lore raw
In reply to Miaoqian Lin

Le 07/03/2022 à 09:45, Miaoqian Lin a écrit :

Quoted 23 lines

Fix the missing clk_disable_unprepare() before return from msm8916_wcd_digital_probe in the error handling case.

Fixes 150db8c5afa1 ("ASoC: codecs: Add msm8916-wcd digital codec")
---
  sound/soc/codecs/msm8916-wcd-digital.c | 5 ++++-
  1 file changed, 4 insertions(+), 1 deletion(-)
sound/soc/codecs/msm8916-wcd-digital.c +1 -1
index fcc10c8bc625..9ad7fc0baf07 100644
@@ -1201,7 +1201,7 @@ static int msm8916_wcd_digital_probe(struct platform_device *pdev)
  	ret = clk_prepare_enable(priv->mclk);
  	if (ret < 0) {
  		dev_err(dev, "failed to enable mclk %d\n", ret);
-		return ret;
+		goto err_clk;
  	}
 
  	dev_set_drvdata(dev, priv);

sound/soc/codecs/msm8916-wcd-digital.c static int msm8916_wcd_digital_probe(struct platform_device *pdev) · line 1217

Quoted 9 lines
sound/soc/codecs/msm8916-wcd-digital.c +3 -0
@@ -1209,6 +1209,9 @@ static int msm8916_wcd_digital_probe(struct platform_device *pdev)
  	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

author
#3 lore raw

Hi,

Yes, I agree with you. We should check the error code of devm_snd_soc_register_component() and do corresponding handling.

Quoted 45 lines · Christophe JAILLET <[email protected]> 于2022年4月3日周日 13:51写道:

Review

Quoted 10 lines · Miaoqian Lin

Fix the missing clk_disable_unprepare() before return from msm8916_wcd_digital_probe in the error handling case.

Fixes 150db8c5afa1 ("ASoC: codecs: Add msm8916-wcd digital codec")
---
  sound/soc/codecs/msm8916-wcd-digital.c | 5 ++++-
  1 file changed, 4 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

b/sound/soc/codecs/msm8916-wcd-digital.c

sound/soc/codecs/msm8916-wcd-digital.c static int msm8916_wcd_digital_probe(struct

Quoted 4 lines

index fcc10c8bc625..9ad7fc0baf07 100644

sound/soc/codecs/msm8916-wcd-digital.c +0 -0
@@ -1201,7 +1201,7 @@ static int msm8916_wcd_digital_probe(struct

platform_device *pdev)

sound/soc/codecs/msm8916-wcd-digital.c static int msm8916_wcd_digital_probe(struct

Quoted 9 lines
sound/soc/codecs/msm8916-wcd-digital.c +1 -1
      ret = clk_prepare_enable(priv->mclk);
      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

platform_device *pdev)

sound/soc/codecs/msm8916-wcd-digital.c static int msm8916_wcd_digital_probe(struct platform_device *pdev) · line 1217

Quoted 9 lines
sound/soc/codecs/msm8916-wcd-digital.c +3 -0
      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

#4 lore raw

Le 03/04/2022 à 09:15, 林妙倩 a écrit :

Quoted 5 lines

Hi,

Yes, I agree with you. We should check the error code of devm_snd_soc_register_component() and do corresponding handling.

You already fixed the first issue, do you mind sending a patch for this one as well?

CJ

Quoted 49 lines
Quoted 45 lines · Christophe JAILLET <[email protected]> 于2022年4月3日周日 13:51写道:

Review

Quoted 10 lines · Miaoqian Lin

Fix the missing clk_disable_unprepare() before return from msm8916_wcd_digital_probe in the error handling case.

Fixes 150db8c5afa1 ("ASoC: codecs: Add msm8916-wcd digital codec")
---
   sound/soc/codecs/msm8916-wcd-digital.c | 5 ++++-
   1 file changed, 4 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

b/sound/soc/codecs/msm8916-wcd-digital.c

sound/soc/codecs/msm8916-wcd-digital.c static int msm8916_wcd_digital_probe(struct

Quoted 4 lines

index fcc10c8bc625..9ad7fc0baf07 100644

sound/soc/codecs/msm8916-wcd-digital.c +0 -0
@@ -1201,7 +1201,7 @@ static int msm8916_wcd_digital_probe(struct

platform_device *pdev)

sound/soc/codecs/msm8916-wcd-digital.c static int msm8916_wcd_digital_probe(struct

Quoted 9 lines
sound/soc/codecs/msm8916-wcd-digital.c +1 -1
       ret = clk_prepare_enable(priv->mclk);
       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

platform_device *pdev)

sound/soc/codecs/msm8916-wcd-digital.c static int msm8916_wcd_digital_probe(struct platform_device *pdev) · line 1217

Quoted 9 lines
sound/soc/codecs/msm8916-wcd-digital.c +3 -0
       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