aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator/max8952.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/regulator/max8952.c')
-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