All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: pcm512x: Fix unbalanced regulator enable call in probe error path
@ 2020-02-20 20:29 Matthias Reichl
  2020-02-20 20:54 ` Pierre-Louis Bossart
  2020-02-20 22:18 ` Applied "ASoC: pcm512x: Fix unbalanced regulator enable call in probe error path" to the asoc tree Mark Brown
  0 siblings, 2 replies; 3+ messages in thread
From: Matthias Reichl @ 2020-02-20 20:29 UTC (permalink / raw)
  To: Mark Brown; +Cc: alsa-devel

When we get a clock error during probe we have to call
regulator_bulk_disable before bailing out, otherwise we trigger
a warning in regulator_put.

Fix this by using "goto err" like in the error cases above.

Fixes: 5a3af1293194d ("ASoC: pcm512x: Add PCM512x driver")
Signed-off-by: Matthias Reichl <hias@horus.com>
---
 sound/soc/codecs/pcm512x.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/sound/soc/codecs/pcm512x.c b/sound/soc/codecs/pcm512x.c
index 861210f6bf4fd..4cbef9affffda 100644
--- a/sound/soc/codecs/pcm512x.c
+++ b/sound/soc/codecs/pcm512x.c
@@ -1564,13 +1564,15 @@ int pcm512x_probe(struct device *dev, struct regmap *regmap)
 	}
 
 	pcm512x->sclk = devm_clk_get(dev, NULL);
-	if (PTR_ERR(pcm512x->sclk) == -EPROBE_DEFER)
-		return -EPROBE_DEFER;
+	if (PTR_ERR(pcm512x->sclk) == -EPROBE_DEFER) {
+		ret = -EPROBE_DEFER;
+		goto err;
+	}
 	if (!IS_ERR(pcm512x->sclk)) {
 		ret = clk_prepare_enable(pcm512x->sclk);
 		if (ret != 0) {
 			dev_err(dev, "Failed to enable SCLK: %d\n", ret);
-			return ret;
+			goto err;
 		}
 	}
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ASoC: pcm512x: Fix unbalanced regulator enable call in probe error path
  2020-02-20 20:29 [PATCH] ASoC: pcm512x: Fix unbalanced regulator enable call in probe error path Matthias Reichl
@ 2020-02-20 20:54 ` Pierre-Louis Bossart
  2020-02-20 22:18 ` Applied "ASoC: pcm512x: Fix unbalanced regulator enable call in probe error path" to the asoc tree Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Pierre-Louis Bossart @ 2020-02-20 20:54 UTC (permalink / raw)
  To: Matthias Reichl, Mark Brown; +Cc: alsa-devel



On 2/20/20 2:29 PM, Matthias Reichl wrote:
> When we get a clock error during probe we have to call
> regulator_bulk_disable before bailing out, otherwise we trigger
> a warning in regulator_put.
> 
> Fix this by using "goto err" like in the error cases above.
> 
> Fixes: 5a3af1293194d ("ASoC: pcm512x: Add PCM512x driver")
> Signed-off-by: Matthias Reichl <hias@horus.com>

LGTM:

Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

> ---
>   sound/soc/codecs/pcm512x.c | 8 +++++---
>   1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/sound/soc/codecs/pcm512x.c b/sound/soc/codecs/pcm512x.c
> index 861210f6bf4fd..4cbef9affffda 100644
> --- a/sound/soc/codecs/pcm512x.c
> +++ b/sound/soc/codecs/pcm512x.c
> @@ -1564,13 +1564,15 @@ int pcm512x_probe(struct device *dev, struct regmap *regmap)
>   	}
>   
>   	pcm512x->sclk = devm_clk_get(dev, NULL);
> -	if (PTR_ERR(pcm512x->sclk) == -EPROBE_DEFER)
> -		return -EPROBE_DEFER;
> +	if (PTR_ERR(pcm512x->sclk) == -EPROBE_DEFER) {
> +		ret = -EPROBE_DEFER;
> +		goto err;
> +	}
>   	if (!IS_ERR(pcm512x->sclk)) {
>   		ret = clk_prepare_enable(pcm512x->sclk);
>   		if (ret != 0) {
>   			dev_err(dev, "Failed to enable SCLK: %d\n", ret);
> -			return ret;
> +			goto err;
>   		}
>   	}
>   
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Applied "ASoC: pcm512x: Fix unbalanced regulator enable call in probe error path" to the asoc tree
  2020-02-20 20:29 [PATCH] ASoC: pcm512x: Fix unbalanced regulator enable call in probe error path Matthias Reichl
  2020-02-20 20:54 ` Pierre-Louis Bossart
@ 2020-02-20 22:18 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2020-02-20 22:18 UTC (permalink / raw)
  To: Matthias Reichl; +Cc: alsa-devel, Mark Brown

The patch

   ASoC: pcm512x: Fix unbalanced regulator enable call in probe error path

has been applied to the asoc tree at

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

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

From ac0a68997935c4acb92eaae5ad8982e0bb432d56 Mon Sep 17 00:00:00 2001
From: Matthias Reichl <hias@horus.com>
Date: Thu, 20 Feb 2020 21:29:56 +0100
Subject: [PATCH] ASoC: pcm512x: Fix unbalanced regulator enable call in probe
 error path

When we get a clock error during probe we have to call
regulator_bulk_disable before bailing out, otherwise we trigger
a warning in regulator_put.

Fix this by using "goto err" like in the error cases above.

Fixes: 5a3af1293194d ("ASoC: pcm512x: Add PCM512x driver")
Signed-off-by: Matthias Reichl <hias@horus.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20200220202956.29233-1-hias@horus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/codecs/pcm512x.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/sound/soc/codecs/pcm512x.c b/sound/soc/codecs/pcm512x.c
index 861210f6bf4f..4cbef9affffd 100644
--- a/sound/soc/codecs/pcm512x.c
+++ b/sound/soc/codecs/pcm512x.c
@@ -1564,13 +1564,15 @@ int pcm512x_probe(struct device *dev, struct regmap *regmap)
 	}
 
 	pcm512x->sclk = devm_clk_get(dev, NULL);
-	if (PTR_ERR(pcm512x->sclk) == -EPROBE_DEFER)
-		return -EPROBE_DEFER;
+	if (PTR_ERR(pcm512x->sclk) == -EPROBE_DEFER) {
+		ret = -EPROBE_DEFER;
+		goto err;
+	}
 	if (!IS_ERR(pcm512x->sclk)) {
 		ret = clk_prepare_enable(pcm512x->sclk);
 		if (ret != 0) {
 			dev_err(dev, "Failed to enable SCLK: %d\n", ret);
-			return ret;
+			goto err;
 		}
 	}
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-02-20 22:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-20 20:29 [PATCH] ASoC: pcm512x: Fix unbalanced regulator enable call in probe error path Matthias Reichl
2020-02-20 20:54 ` Pierre-Louis Bossart
2020-02-20 22:18 ` Applied "ASoC: pcm512x: Fix unbalanced regulator enable call in probe error path" to the asoc tree Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.