1 From 9a536b0cb8f83bd979fe274ef0197ece12a3ed09 Mon Sep 17 00:00:00 2001
2 From: Matthias Reichl <hias@horus.com>
3 Date: Thu, 20 Feb 2020 21:29:56 +0100
4 Subject: [PATCH] ASoC: pcm512x: Fix unbalanced regulator enable call
7 commit ac0a68997935c4acb92eaae5ad8982e0bb432d56 upstream.
9 When we get a clock error during probe we have to call
10 regulator_bulk_disable before bailing out, otherwise we trigger
11 a warning in regulator_put.
13 Fix this by using "goto err" like in the error cases above.
15 Fixes: 5a3af1293194d ("ASoC: pcm512x: Add PCM512x driver")
16 Signed-off-by: Matthias Reichl <hias@horus.com>
17 Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
18 Link: https://lore.kernel.org/r/20200220202956.29233-1-hias@horus.com
19 Signed-off-by: Mark Brown <broonie@kernel.org>
21 sound/soc/codecs/pcm512x.c | 8 +++++---
22 1 file changed, 5 insertions(+), 3 deletions(-)
24 --- a/sound/soc/codecs/pcm512x.c
25 +++ b/sound/soc/codecs/pcm512x.c
26 @@ -1564,13 +1564,15 @@ int pcm512x_probe(struct device *dev, st
29 pcm512x->sclk = devm_clk_get(dev, NULL);
30 - if (PTR_ERR(pcm512x->sclk) == -EPROBE_DEFER)
31 - return -EPROBE_DEFER;
32 + if (PTR_ERR(pcm512x->sclk) == -EPROBE_DEFER) {
33 + ret = -EPROBE_DEFER;
36 if (!IS_ERR(pcm512x->sclk)) {
37 ret = clk_prepare_enable(pcm512x->sclk);
39 dev_err(dev, "Failed to enable SCLK: %d\n", ret);