ae9b9f44fafd7b9a867abac49434a3bd0fd4492c
[openwrt/staging/stintel.git] /
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
5 in probe error path
6
7 commit ac0a68997935c4acb92eaae5ad8982e0bb432d56 upstream.
8
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.
12
13 Fix this by using "goto err" like in the error cases above.
14
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>
20 ---
21 sound/soc/codecs/pcm512x.c | 8 +++++---
22 1 file changed, 5 insertions(+), 3 deletions(-)
23
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
27 }
28
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;
34 + goto err;
35 + }
36 if (!IS_ERR(pcm512x->sclk)) {
37 ret = clk_prepare_enable(pcm512x->sclk);
38 if (ret != 0) {
39 dev_err(dev, "Failed to enable SCLK: %d\n", ret);
40 - return ret;
41 + goto err;
42 }
43 }
44