2021-12-23 08:16:23

by Yang Yingliang

[permalink] [raw]
Subject: [PATCH -next] ASoC: codec: tlv320adc3xxx: Fix missing clk_disable_unprepare() on error in adc3xxx_i2c_probe()

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

Fixes: e9a3b57efd28 ("ASoC: codec: tlv320adc3xxx: New codec driver")
Reported-by: Hulk Robot <[email protected]>
Signed-off-by: Yang Yingliang <[email protected]>
---
sound/soc/codecs/tlv320adc3xxx.c | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/sound/soc/codecs/tlv320adc3xxx.c b/sound/soc/codecs/tlv320adc3xxx.c
index a683bda7eb36..4baf3d881633 100644
--- a/sound/soc/codecs/tlv320adc3xxx.c
+++ b/sound/soc/codecs/tlv320adc3xxx.c
@@ -1232,21 +1232,21 @@ static int adc3xxx_i2c_probe(struct i2c_client *i2c,

ret = adc3xxx_parse_dt_gpio(adc3xxx, "ti,dmdin-gpio1", &adc3xxx->gpio_cfg[0]);
if (ret < 0)
- return ret;
+ goto err_unprepare_mclk;
ret = adc3xxx_parse_dt_gpio(adc3xxx, "ti,dmclk-gpio2", &adc3xxx->gpio_cfg[1]);
if (ret < 0)
- return ret;
+ goto err_unprepare_mclk;
ret = adc3xxx_parse_dt_micbias(adc3xxx, "ti,micbias1-vg", &adc3xxx->micbias_vg[0]);
if (ret < 0)
- return ret;
+ goto err_unprepare_mclk;
ret = adc3xxx_parse_dt_micbias(adc3xxx, "ti,micbias2-vg", &adc3xxx->micbias_vg[1]);
if (ret < 0)
- return ret;
+ goto err_unprepare_mclk;

adc3xxx->regmap = devm_regmap_init_i2c(i2c, &adc3xxx_regmap);
if (IS_ERR(adc3xxx->regmap)) {
ret = PTR_ERR(adc3xxx->regmap);
- return ret;
+ goto err_unprepare_mclk;
}

i2c_set_clientdata(i2c, adc3xxx);
@@ -1263,9 +1263,15 @@ static int adc3xxx_i2c_probe(struct i2c_client *i2c,

ret = snd_soc_register_component(dev,
&soc_component_dev_adc3xxx, &adc3xxx_dai, 1);
- if (ret < 0)
+ if (ret < 0) {
dev_err(dev, "Failed to register codec: %d\n", ret);
+ goto err_unprepare_mclk;
+ }
+
+ return 0;

+err_unprepare_mclk:
+ clk_disable_unprepare(adc3xxx->mclk);
return ret;
}

--
2.25.1



2021-12-23 17:17:53

by Mark Brown

[permalink] [raw]
Subject: Re: [PATCH -next] ASoC: codec: tlv320adc3xxx: Fix missing clk_disable_unprepare() on error in adc3xxx_i2c_probe()

On Thu, 23 Dec 2021 16:22:12 +0800, Yang Yingliang wrote:
> Fix the missing clk_disable_unprepare() before return
> from adc3xxx_i2c_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: codec: tlv320adc3xxx: Fix missing clk_disable_unprepare() on error in adc3xxx_i2c_probe()
commit: 8a2d8e4fed6d5829ec3681af313d63e02bc22dad

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