[PATCH 14/20] regulator: max8952: use devm_regulator_register()

From: Jingoo Han
Date: Wed Sep 25 2013 - 04:08:23 EST


Use devm_regulator_register() to make cleanup paths simpler.

Signed-off-by: Jingoo Han <jg1.han@xxxxxxxxxxx>
---
drivers/regulator/max8952.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/regulator/max8952.c b/drivers/regulator/max8952.c
index 788e5ae..6fb7ec1 100644
--- a/drivers/regulator/max8952.c
+++ b/drivers/regulator/max8952.c
@@ -231,7 +231,8 @@ static int max8952_pmic_probe(struct i2c_client *client,
if (pdata->reg_data->constraints.boot_on)
config.ena_gpio_flags |= GPIOF_OUT_INIT_HIGH;

- max8952->rdev = regulator_register(&regulator, &config);
+ max8952->rdev = devm_regulator_register(&client->dev, &regulator,
+ &config);

if (IS_ERR(max8952->rdev)) {
ret = PTR_ERR(max8952->rdev);
@@ -321,9 +322,6 @@ static int max8952_pmic_remove(struct i2c_client *client)
{
struct max8952_data *max8952 = i2c_get_clientdata(client);
struct max8952_platform_data *pdata = max8952->pdata;
- struct regulator_dev *rdev = max8952->rdev;
-
- regulator_unregister(rdev);

gpio_free(pdata->gpio_vid0);
gpio_free(pdata->gpio_vid1);
--
1.7.10.4


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/