diff options
author | Nikolay Balandin <nbalandin@dev.rtsoft.ru> | 2013-05-25 21:50:40 (GMT) |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2013-05-27 12:18:30 (GMT) |
commit | 2af0af67354b7c9b17d28e6ab47a8177afec125d (patch) | |
tree | 6009ef47039f6300162a0713304fe85e651aeac8 /drivers/regulator/lp3971.c | |
parent | e4aa937ec75df0eea0bee03bffa3303ad36c986b (diff) | |
download | linux-2af0af67354b7c9b17d28e6ab47a8177afec125d.tar.xz |
regulator: lp397x: use devm_kzalloc() to make cleanup paths simpler
Signed-off-by: Nikolay Balandin <nbalandin@dev.rtsoft.ru>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/regulator/lp3971.c')
-rw-r--r-- | drivers/regulator/lp3971.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/drivers/regulator/lp3971.c b/drivers/regulator/lp3971.c index d8af9e7..3809b43 100644 --- a/drivers/regulator/lp3971.c +++ b/drivers/regulator/lp3971.c @@ -434,7 +434,7 @@ static int lp3971_i2c_probe(struct i2c_client *i2c, return -ENODEV; } - lp3971 = kzalloc(sizeof(struct lp3971), GFP_KERNEL); + lp3971 = devm_kzalloc(&i2c->dev, sizeof(struct lp3971), GFP_KERNEL); if (lp3971 == NULL) return -ENOMEM; @@ -449,19 +449,15 @@ static int lp3971_i2c_probe(struct i2c_client *i2c, ret = -ENODEV; if (ret < 0) { dev_err(&i2c->dev, "failed to detect device\n"); - goto err_detect; + return ret; } ret = setup_regulators(lp3971, pdata); if (ret < 0) - goto err_detect; + return ret; i2c_set_clientdata(i2c, lp3971); return 0; - -err_detect: - kfree(lp3971); - return ret; } static int lp3971_i2c_remove(struct i2c_client *i2c) @@ -473,7 +469,6 @@ static int lp3971_i2c_remove(struct i2c_client *i2c) regulator_unregister(lp3971->rdev[i]); kfree(lp3971->rdev); - kfree(lp3971); return 0; } |