Commit 8b7a4075 authored by Mark Brown's avatar Mark Brown

ASOC: Fix the error handling code of the probe

Merge series from Zheyu Ma <zheyuma97@gmail.com>:

These drivers mishandle the regulator resource in the probe function,
failing to disable the regulator for probing failure.
parents de242720 c1ce4ba5
...@@ -1803,7 +1803,7 @@ static int cs35l36_i2c_probe(struct i2c_client *i2c_client) ...@@ -1803,7 +1803,7 @@ static int cs35l36_i2c_probe(struct i2c_client *i2c_client)
if (ret < 0) { if (ret < 0) {
dev_err(&i2c_client->dev, "Failed to read otp_id Register %d\n", dev_err(&i2c_client->dev, "Failed to read otp_id Register %d\n",
ret); ret);
return ret; goto err;
} }
if ((l37_id_reg & CS35L36_OTP_REV_MASK) == CS35L36_OTP_REV_L37) if ((l37_id_reg & CS35L36_OTP_REV_MASK) == CS35L36_OTP_REV_L37)
......
...@@ -3943,7 +3943,7 @@ static int rt5645_i2c_probe(struct i2c_client *i2c) ...@@ -3943,7 +3943,7 @@ static int rt5645_i2c_probe(struct i2c_client *i2c)
ret = PTR_ERR(regmap); ret = PTR_ERR(regmap);
dev_err(&i2c->dev, "Failed to allocate temp register map: %d\n", dev_err(&i2c->dev, "Failed to allocate temp register map: %d\n",
ret); ret);
return ret; goto err_enable;
} }
/* /*
...@@ -3974,7 +3974,7 @@ static int rt5645_i2c_probe(struct i2c_client *i2c) ...@@ -3974,7 +3974,7 @@ static int rt5645_i2c_probe(struct i2c_client *i2c)
ret = PTR_ERR(rt5645->regmap); ret = PTR_ERR(rt5645->regmap);
dev_err(&i2c->dev, "Failed to allocate register map: %d\n", dev_err(&i2c->dev, "Failed to allocate register map: %d\n",
ret); ret);
return ret; goto err_enable;
} }
regmap_write(rt5645->regmap, RT5645_RESET, 0); regmap_write(rt5645->regmap, RT5645_RESET, 0);
......
...@@ -833,7 +833,8 @@ static int tas571x_i2c_probe(struct i2c_client *client) ...@@ -833,7 +833,8 @@ static int tas571x_i2c_probe(struct i2c_client *client)
if (IS_ERR(priv->pdn_gpio)) { if (IS_ERR(priv->pdn_gpio)) {
dev_err(dev, "error requesting pdn_gpio: %ld\n", dev_err(dev, "error requesting pdn_gpio: %ld\n",
PTR_ERR(priv->pdn_gpio)); PTR_ERR(priv->pdn_gpio));
return PTR_ERR(priv->pdn_gpio); ret = PTR_ERR(priv->pdn_gpio);
goto disable_regs;
} }
priv->reset_gpio = devm_gpiod_get_optional(dev, "reset", priv->reset_gpio = devm_gpiod_get_optional(dev, "reset",
...@@ -841,7 +842,8 @@ static int tas571x_i2c_probe(struct i2c_client *client) ...@@ -841,7 +842,8 @@ static int tas571x_i2c_probe(struct i2c_client *client)
if (IS_ERR(priv->reset_gpio)) { if (IS_ERR(priv->reset_gpio)) {
dev_err(dev, "error requesting reset_gpio: %ld\n", dev_err(dev, "error requesting reset_gpio: %ld\n",
PTR_ERR(priv->reset_gpio)); PTR_ERR(priv->reset_gpio));
return PTR_ERR(priv->reset_gpio); ret = PTR_ERR(priv->reset_gpio);
goto disable_regs;
} else if (priv->reset_gpio) { } else if (priv->reset_gpio) {
/* pulse the active low reset line for ~100us */ /* pulse the active low reset line for ~100us */
usleep_range(100, 200); usleep_range(100, 200);
......
...@@ -756,7 +756,7 @@ static int tas6424_i2c_probe(struct i2c_client *client) ...@@ -756,7 +756,7 @@ static int tas6424_i2c_probe(struct i2c_client *client)
TAS6424_RESET, TAS6424_RESET); TAS6424_RESET, TAS6424_RESET);
if (ret) { if (ret) {
dev_err(dev, "unable to reset device: %d\n", ret); dev_err(dev, "unable to reset device: %d\n", ret);
return ret; goto disable_regs;
} }
INIT_DELAYED_WORK(&tas6424->fault_check_work, tas6424_fault_check_work); INIT_DELAYED_WORK(&tas6424->fault_check_work, tas6424_fault_check_work);
...@@ -765,10 +765,14 @@ static int tas6424_i2c_probe(struct i2c_client *client) ...@@ -765,10 +765,14 @@ static int tas6424_i2c_probe(struct i2c_client *client)
tas6424_dai, ARRAY_SIZE(tas6424_dai)); tas6424_dai, ARRAY_SIZE(tas6424_dai));
if (ret < 0) { if (ret < 0) {
dev_err(dev, "unable to register codec: %d\n", ret); dev_err(dev, "unable to register codec: %d\n", ret);
return ret; goto disable_regs;
} }
return 0; return 0;
disable_regs:
regulator_bulk_disable(ARRAY_SIZE(tas6424->supplies), tas6424->supplies);
return ret;
} }
static int tas6424_i2c_remove(struct i2c_client *client) static int tas6424_i2c_remove(struct i2c_client *client)
......
...@@ -2131,7 +2131,7 @@ static int wm8903_i2c_probe(struct i2c_client *i2c) ...@@ -2131,7 +2131,7 @@ static int wm8903_i2c_probe(struct i2c_client *i2c)
if (ret != 0) { if (ret != 0) {
dev_err(wm8903->dev, "Failed to request IRQ: %d\n", dev_err(wm8903->dev, "Failed to request IRQ: %d\n",
ret); ret);
return ret; goto err;
} }
/* Enable write sequencer interrupts */ /* Enable write sequencer interrupts */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment