mirror of
https://github.com/torvalds/linux.git
synced 2026-06-06 13:37:36 +02:00
ASoC: cs42l42: Disable regulators if probe fails
[ Upstream commit 1abca8e1c7 ]
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>
This commit is contained in:
parent
c0faad6e9d
commit
ef9d007a91
|
|
@ -1781,8 +1781,10 @@ static int cs42l42_i2c_probe(struct i2c_client *i2c_client,
|
||||||
/* Reset the Device */
|
/* Reset the Device */
|
||||||
cs42l42->reset_gpio = devm_gpiod_get_optional(&i2c_client->dev,
|
cs42l42->reset_gpio = devm_gpiod_get_optional(&i2c_client->dev,
|
||||||
"reset", GPIOD_OUT_LOW);
|
"reset", GPIOD_OUT_LOW);
|
||||||
if (IS_ERR(cs42l42->reset_gpio))
|
if (IS_ERR(cs42l42->reset_gpio)) {
|
||||||
return PTR_ERR(cs42l42->reset_gpio);
|
ret = PTR_ERR(cs42l42->reset_gpio);
|
||||||
|
goto err_disable;
|
||||||
|
}
|
||||||
|
|
||||||
if (cs42l42->reset_gpio) {
|
if (cs42l42->reset_gpio) {
|
||||||
dev_dbg(&i2c_client->dev, "Found reset GPIO\n");
|
dev_dbg(&i2c_client->dev, "Found reset GPIO\n");
|
||||||
|
|
@ -1817,13 +1819,13 @@ static int cs42l42_i2c_probe(struct i2c_client *i2c_client,
|
||||||
dev_err(&i2c_client->dev,
|
dev_err(&i2c_client->dev,
|
||||||
"CS42L42 Device ID (%X). Expected %X\n",
|
"CS42L42 Device ID (%X). Expected %X\n",
|
||||||
devid, CS42L42_CHIP_ID);
|
devid, CS42L42_CHIP_ID);
|
||||||
return ret;
|
goto err_disable;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = regmap_read(cs42l42->regmap, CS42L42_REVID, ®);
|
ret = regmap_read(cs42l42->regmap, CS42L42_REVID, ®);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
dev_err(&i2c_client->dev, "Get Revision ID failed\n");
|
dev_err(&i2c_client->dev, "Get Revision ID failed\n");
|
||||||
return ret;
|
goto err_disable;
|
||||||
}
|
}
|
||||||
|
|
||||||
dev_info(&i2c_client->dev,
|
dev_info(&i2c_client->dev,
|
||||||
|
|
@ -1849,7 +1851,7 @@ static int cs42l42_i2c_probe(struct i2c_client *i2c_client,
|
||||||
if (i2c_client->dev.of_node) {
|
if (i2c_client->dev.of_node) {
|
||||||
ret = cs42l42_handle_device_data(i2c_client, cs42l42);
|
ret = cs42l42_handle_device_data(i2c_client, cs42l42);
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
return ret;
|
goto err_disable;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Setup headset detection */
|
/* Setup headset detection */
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user