Skip to content

Commit

Permalink
ASoC: tlv320dac33: Use devm_regulator_bulk_get()
Browse files Browse the repository at this point in the history
Using devm_regulator_bulk_get() can make the code cleaner and smaller as we
do not need to call regulator_bulk_free() in the error and remove paths.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
  • Loading branch information
Fabio Estevam authored and Mark Brown committed Apr 25, 2014
1 parent c9eaa44 commit e9382e3
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions sound/soc/codecs/tlv320dac33.c
Original file line number Diff line number Diff line change
Expand Up @@ -1540,7 +1540,7 @@ static int dac33_i2c_probe(struct i2c_client *client,
for (i = 0; i < ARRAY_SIZE(dac33->supplies); i++)
dac33->supplies[i].supply = dac33_supply_names[i];

ret = regulator_bulk_get(&client->dev, ARRAY_SIZE(dac33->supplies),
ret = devm_regulator_bulk_get(&client->dev, ARRAY_SIZE(dac33->supplies),
dac33->supplies);

if (ret != 0) {
Expand All @@ -1551,11 +1551,9 @@ static int dac33_i2c_probe(struct i2c_client *client,
ret = snd_soc_register_codec(&client->dev,
&soc_codec_dev_tlv320dac33, &dac33_dai, 1);
if (ret < 0)
goto err_register;
goto err_get;

return ret;
err_register:
regulator_bulk_free(ARRAY_SIZE(dac33->supplies), dac33->supplies);
err_get:
if (dac33->power_gpio >= 0)
gpio_free(dac33->power_gpio);
Expand All @@ -1573,8 +1571,6 @@ static int dac33_i2c_remove(struct i2c_client *client)
if (dac33->power_gpio >= 0)
gpio_free(dac33->power_gpio);

regulator_bulk_free(ARRAY_SIZE(dac33->supplies), dac33->supplies);

snd_soc_unregister_codec(&client->dev);
return 0;
}
Expand Down

0 comments on commit e9382e3

Please sign in to comment.