summaryrefslogtreecommitdiff
path: root/drivers/regulator/da9211-regulator.c
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@ingics.com>2014-07-20 19:19:35 +0800
committerMark Brown <broonie@linaro.org>2014-07-25 18:23:28 +0100
commit516c1514b089e1c60a392b281f6c90f4b8e49183 (patch)
tree06120b7e4447b06b3a7ee9993d422a8b530fe730 /drivers/regulator/da9211-regulator.c
parent1028a37daa148cc6cf85aa2aecb4390ddf1e1e56 (diff)
regulator: da9211: Remove unnecessary devm_regulator_unregister() calls
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> Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'drivers/regulator/da9211-regulator.c')
-rw-r--r--drivers/regulator/da9211-regulator.c28
1 files changed, 4 insertions, 24 deletions
diff --git a/drivers/regulator/da9211-regulator.c b/drivers/regulator/da9211-regulator.c
index bd1850658a3f..1482adafa1ad 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,
};