All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] regulator: da9211: Remove unnecessary devm_regulator_unregister() calls
@ 2014-07-20 11:19 Axel Lin
  2014-07-25 17:23 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Axel Lin @ 2014-07-20 11:19 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown; +Cc: James Ban, Support Opensource, linux-kernel

Current code uses devm_regulator_register(), so the resource management code
will ensure that the resource is freed.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
 drivers/regulator/da9211-regulator.c | 28 ++++------------------------
 1 file changed, 4 insertions(+), 24 deletions(-)

diff --git a/drivers/regulator/da9211-regulator.c b/drivers/regulator/da9211-regulator.c
index bd18506..1482ada 100644
--- a/drivers/regulator/da9211-regulator.c
+++ b/drivers/regulator/da9211-regulator.c
@@ -245,7 +245,7 @@ static int da9211_regulator_init(struct da9211 *chip)
 	ret = regmap_read(chip->regmap, DA9211_REG_CONFIG_E, &data);
 	if (ret < 0) {
 		dev_err(chip->dev, "Failed to read CONTROL_E reg: %d\n", ret);
-		goto err;
+		return ret;
 	}
 
 	data &= DA9211_SLAVE_SEL;
@@ -259,9 +259,8 @@ static int da9211_regulator_init(struct da9211 *chip)
 		else
 			chip->num_regulator = 2;
 	} else {
-		ret = -EINVAL;
 		dev_err(chip->dev, "Configuration is mismatched\n");
-		goto err;
+		return -EINVAL;
 	}
 
 	for (i = 0; i < chip->num_regulator; i++) {
@@ -278,8 +277,7 @@ static int da9211_regulator_init(struct da9211 *chip)
 		if (IS_ERR(chip->rdev[i])) {
 			dev_err(chip->dev,
 				"Failed to register DA9211 regulator\n");
-			ret = PTR_ERR(chip->rdev[i]);
-			goto err_regulator;
+			return PTR_ERR(chip->rdev[i]);
 		}
 
 		if (chip->chip_irq != 0) {
@@ -288,18 +286,12 @@ static int da9211_regulator_init(struct da9211 *chip)
 			if (ret < 0) {
 				dev_err(chip->dev,
 					"Failed to update mask reg: %d\n", ret);
-				goto err_regulator;
+				return ret;
 			}
 		}
 	}
 
 	return 0;
-
-err_regulator:
-	while (--i >= 0)
-		devm_regulator_unregister(chip->dev, chip->rdev[i]);
-err:
-	return ret;
 }
 /*
  * I2C driver interface functions
@@ -353,17 +345,6 @@ static int da9211_i2c_probe(struct i2c_client *i2c,
 	return ret;
 }
 
-static int da9211_i2c_remove(struct i2c_client *i2c)
-{
-	struct da9211 *chip = i2c_get_clientdata(i2c);
-	int i;
-
-	for (i = 0; i < chip->num_regulator; i++)
-		devm_regulator_unregister(chip->dev, chip->rdev[i]);
-
-	return 0;
-}
-
 static const struct i2c_device_id da9211_i2c_id[] = {
 	{"da9211", 0},
 	{},
@@ -377,7 +358,6 @@ static struct i2c_driver da9211_regulator_driver = {
 		.owner = THIS_MODULE,
 	},
 	.probe = da9211_i2c_probe,
-	.remove = da9211_i2c_remove,
 	.id_table = da9211_i2c_id,
 };
 
-- 
1.9.1




^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] regulator: da9211: Remove unnecessary devm_regulator_unregister() calls
  2014-07-20 11:19 [PATCH] regulator: da9211: Remove unnecessary devm_regulator_unregister() calls Axel Lin
@ 2014-07-25 17:23 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2014-07-25 17:23 UTC (permalink / raw)
  To: Axel Lin; +Cc: Liam Girdwood, James Ban, Support Opensource, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 197 bytes --]

On Sun, Jul 20, 2014 at 07:19:35PM +0800, Axel Lin wrote:
> Current code uses devm_regulator_register(), so the resource management code
> will ensure that the resource is freed.

Applied, thanks.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-07-25 17:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-20 11:19 [PATCH] regulator: da9211: Remove unnecessary devm_regulator_unregister() calls Axel Lin
2014-07-25 17:23 ` Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.