[1/4] ASoC: tlv320dac3: Use devm_regulator_bulk_get()
diff mbox

Message ID 1398389226-18569-1-git-send-email-festevam@gmail.com
State Accepted
Commit e9382e3b7a048d4cfc39139caa86b755a74d4da8
Headers show

Commit Message

Fabio Estevam April 25, 2014, 1:27 a.m. UTC
From: Fabio Estevam <fabio.estevam@freescale.com>

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>
---
 sound/soc/codecs/tlv320dac33.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

Comments

Jarkko Nikula April 25, 2014, 5:39 a.m. UTC | #1
On 04/25/2014 04:27 AM, Fabio Estevam wrote:
> From: Fabio Estevam <fabio.estevam@freescale.com>
>
> 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>
> ---
>   sound/soc/codecs/tlv320dac33.c | 8 ++------
>   1 file changed, 2 insertions(+), 6 deletions(-)
>
Small typo in patch title: tlv320dac3 instead of tlv320dac33.
Mark Brown April 25, 2014, 11:16 a.m. UTC | #2
On Thu, Apr 24, 2014 at 10:27:03PM -0300, Fabio Estevam wrote:
> From: Fabio Estevam <fabio.estevam@freescale.com>
> 
> 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.

Applied, thanks.

Patch
diff mbox

diff --git a/sound/soc/codecs/tlv320dac33.c b/sound/soc/codecs/tlv320dac33.c
index 517055a..df3a750 100644
--- a/sound/soc/codecs/tlv320dac33.c
+++ b/sound/soc/codecs/tlv320dac33.c
@@ -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) {
@@ -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);
@@ -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;
 }