[04/14] ASoC: wm8993: Use devm_regulator_bulk_get

Message ID 1353930587-12907-5-git-send-email-sachin.kamat@linaro.org
State Accepted
Headers show

Commit Message

Sachin Kamat Nov. 26, 2012, 11:49 a.m.
devm_regulator_bulk_get() is device managed and makes error
handling and code cleanup simpler.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
---
 sound/soc/codecs/wm8993.c |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)

Comments

Mark Brown Nov. 28, 2012, 5:41 p.m. | #1
On Mon, Nov 26, 2012 at 05:19:37PM +0530, Sachin Kamat wrote:
> devm_regulator_bulk_get() is device managed and makes error
> handling and code cleanup simpler.

Applied, thanks.  CC maintainers.

Patch

diff --git a/sound/soc/codecs/wm8993.c b/sound/soc/codecs/wm8993.c
index 94737a3..c3d3107 100644
--- a/sound/soc/codecs/wm8993.c
+++ b/sound/soc/codecs/wm8993.c
@@ -1672,7 +1672,7 @@  static __devinit int wm8993_i2c_probe(struct i2c_client *i2c,
 	for (i = 0; i < ARRAY_SIZE(wm8993->supplies); i++)
 		wm8993->supplies[i].supply = wm8993_supply_names[i];
 
-	ret = regulator_bulk_get(&i2c->dev, ARRAY_SIZE(wm8993->supplies),
+	ret = devm_regulator_bulk_get(&i2c->dev, ARRAY_SIZE(wm8993->supplies),
 				 wm8993->supplies);
 	if (ret != 0) {
 		dev_err(&i2c->dev, "Failed to request supplies: %d\n", ret);
@@ -1683,7 +1683,7 @@  static __devinit int wm8993_i2c_probe(struct i2c_client *i2c,
 				    wm8993->supplies);
 	if (ret != 0) {
 		dev_err(&i2c->dev, "Failed to enable supplies: %d\n", ret);
-		goto err_get;
+		goto err;
 	}
 
 	ret = regmap_read(wm8993->regmap, WM8993_SOFTWARE_RESET, &reg);
@@ -1742,8 +1742,6 @@  err_irq:
 		free_irq(i2c->irq, wm8993);
 err_enable:
 	regulator_bulk_disable(ARRAY_SIZE(wm8993->supplies), wm8993->supplies);
-err_get:
-	regulator_bulk_free(ARRAY_SIZE(wm8993->supplies), wm8993->supplies);
 err:
 	regmap_exit(wm8993->regmap);
 	return ret;
@@ -1758,7 +1756,6 @@  static __devexit int wm8993_i2c_remove(struct i2c_client *i2c)
 		free_irq(i2c->irq, wm8993);
 	regmap_exit(wm8993->regmap);
 	regulator_bulk_disable(ARRAY_SIZE(wm8993->supplies), wm8993->supplies);
-	regulator_bulk_free(ARRAY_SIZE(wm8993->supplies), wm8993->supplies);
 
 	return 0;
 }