aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@gmail.com>2010-10-24 22:11:07 -0400
committerLiam Girdwood <lrg@slimlogic.co.uk>2010-10-28 17:40:32 -0400
commitda05738e94b644d759f28184a9f0bf875b271c55 (patch)
tree324457b3aa0eefde5e53d86ae00b3488d94d4ddd /drivers/regulator
parentf5ee10ab42c76f36eea1bd6f7a35da387635ebf9 (diff)
regulator: max8952 - fix max8952_pmic_probe error path
Signed-off-by: Axel Lin <axel.lin@gmail.com> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
Diffstat (limited to 'drivers/regulator')
-rw-r--r--drivers/regulator/max8952.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/regulator/max8952.c b/drivers/regulator/max8952.c
index f2af0b1c3925..7d6aacf5c493 100644
--- a/drivers/regulator/max8952.c
+++ b/drivers/regulator/max8952.c
@@ -212,9 +212,11 @@ static int __devinit max8952_pmic_probe(struct i2c_client *client,
212 max8952->rdev = regulator_register(&regulator, max8952->dev, 212 max8952->rdev = regulator_register(&regulator, max8952->dev,
213 &pdata->reg_data, max8952); 213 &pdata->reg_data, max8952);
214 214
215 ret = IS_ERR(max8952->rdev); 215 if (IS_ERR(max8952->rdev)) {
216 if (ret) 216 ret = PTR_ERR(max8952->rdev);
217 dev_err(max8952->dev, "regulator init failed (%d)\n", ret); 217 dev_err(max8952->dev, "regulator init failed (%d)\n", ret);
218 goto err_reg;
219 }
218 220
219 max8952->en = !!(pdata->reg_data.constraints.boot_on); 221 max8952->en = !!(pdata->reg_data.constraints.boot_on);
220 max8952->vid0 = (pdata->default_mode % 2) == 1; 222 max8952->vid0 = (pdata->default_mode % 2) == 1;
@@ -309,6 +311,10 @@ static int __devinit max8952_pmic_probe(struct i2c_client *client,
309 311
310 i2c_set_clientdata(client, max8952); 312 i2c_set_clientdata(client, max8952);
311 313
314 return 0;
315
316err_reg:
317 kfree(max8952);
312 return ret; 318 return ret;
313} 319}
314 320