Skip to content

Commit ef9d007

Browse files
Lucas Tanuregregkh
authored andcommitted
ASoC: cs42l42: Disable regulators if probe fails
[ Upstream commit 1abca8e ] In case of cs42l42_i2c_probe() fail, the regulators were left enabled. Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com> Link: https://lore.kernel.org/r/20210306185553.62053-8-tanureal@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent c0faad6 commit ef9d007

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

‎sound/soc/codecs/cs42l42.c‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1781,8 +1781,10 @@ static int cs42l42_i2c_probe(struct i2c_client *i2c_client,
17811781
/* Reset the Device */
17821782
cs42l42->reset_gpio = devm_gpiod_get_optional(&i2c_client->dev,
17831783
"reset", GPIOD_OUT_LOW);
1784-
if (IS_ERR(cs42l42->reset_gpio))
1785-
return PTR_ERR(cs42l42->reset_gpio);
1784+
if (IS_ERR(cs42l42->reset_gpio)) {
1785+
ret = PTR_ERR(cs42l42->reset_gpio);
1786+
goto err_disable;
1787+
}
17861788

17871789
if (cs42l42->reset_gpio) {
17881790
dev_dbg(&i2c_client->dev, "Found reset GPIO\n");
@@ -1817,13 +1819,13 @@ static int cs42l42_i2c_probe(struct i2c_client *i2c_client,
18171819
dev_err(&i2c_client->dev,
18181820
"CS42L42 Device ID (%X). Expected %X\n",
18191821
devid, CS42L42_CHIP_ID);
1820-
return ret;
1822+
goto err_disable;
18211823
}
18221824

18231825
ret = regmap_read(cs42l42->regmap, CS42L42_REVID, &reg);
18241826
if (ret < 0) {
18251827
dev_err(&i2c_client->dev, "Get Revision ID failed\n");
1826-
return ret;
1828+
goto err_disable;
18271829
}
18281830

18291831
dev_info(&i2c_client->dev,
@@ -1849,7 +1851,7 @@ static int cs42l42_i2c_probe(struct i2c_client *i2c_client,
18491851
if (i2c_client->dev.of_node) {
18501852
ret = cs42l42_handle_device_data(i2c_client, cs42l42);
18511853
if (ret != 0)
1852-
return ret;
1854+
goto err_disable;
18531855
}
18541856

18551857
/* Setup headset detection */

0 commit comments

Comments
 (0)