[PATCH v1 1/1] drivers/misc: lis3lv02d: convert to use devm_regulator_bulk_get

From: Nikolay Balandin
Date: Wed May 29 2013 - 07:45:43 EST


From: Nikolay Balandin <nbalandin@xxxxxxxxxxxxx>

Use devm_regulator_bulk_get to make cleanup paths simpler

Signed-off-by: Nikolay Balandin <nbalandin@xxxxxxxxxxxxx>
---
drivers/misc/lis3lv02d/lis3lv02d_i2c.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/misc/lis3lv02d/lis3lv02d_i2c.c b/drivers/misc/lis3lv02d/lis3lv02d_i2c.c
index 7c97550..01ddcf0 100644
--- a/drivers/misc/lis3lv02d/lis3lv02d_i2c.c
+++ b/drivers/misc/lis3lv02d/lis3lv02d_i2c.c
@@ -154,7 +154,7 @@ static int lis3lv02d_i2c_probe(struct i2c_client *client,

lis3_dev.regulators[0].supply = reg_vdd;
lis3_dev.regulators[1].supply = reg_vdd_io;
- ret = regulator_bulk_get(&client->dev,
+ ret = devm_regulator_bulk_get(&client->dev,
ARRAY_SIZE(lis3_dev.regulators),
lis3_dev.regulators);
if (ret < 0)
@@ -179,12 +179,9 @@ static int lis3lv02d_i2c_probe(struct i2c_client *client,
lis3_reg_ctrl(&lis3_dev, LIS3_REG_OFF);

if (ret)
- goto fail2;
+ goto fail;
return 0;

-fail2:
- regulator_bulk_free(ARRAY_SIZE(lis3_dev.regulators),
- lis3_dev.regulators);
fail:
if (pdata && pdata->release_resources)
pdata->release_resources();
@@ -202,8 +199,6 @@ static int lis3lv02d_i2c_remove(struct i2c_client *client)
lis3lv02d_joystick_disable(lis3);
lis3lv02d_remove_fs(&lis3_dev);

- regulator_bulk_free(ARRAY_SIZE(lis3->regulators),
- lis3_dev.regulators);
return 0;
}

--
1.7.9.5

--
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/