Commit da05738e authored by Axel Lin's avatar Axel Lin Committed by Liam Girdwood

regulator: max8952 - fix max8952_pmic_probe error path

Signed-off-by: default avatarAxel Lin <axel.lin@gmail.com>
Acked-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: default avatarLiam Girdwood <lrg@slimlogic.co.uk>
parent f5ee10ab
...@@ -212,9 +212,11 @@ static int __devinit max8952_pmic_probe(struct i2c_client *client, ...@@ -212,9 +212,11 @@ static int __devinit max8952_pmic_probe(struct i2c_client *client,
max8952->rdev = regulator_register(&regulator, max8952->dev, max8952->rdev = regulator_register(&regulator, max8952->dev,
&pdata->reg_data, max8952); &pdata->reg_data, max8952);
ret = IS_ERR(max8952->rdev); if (IS_ERR(max8952->rdev)) {
if (ret) ret = PTR_ERR(max8952->rdev);
dev_err(max8952->dev, "regulator init failed (%d)\n", ret); dev_err(max8952->dev, "regulator init failed (%d)\n", ret);
goto err_reg;
}
max8952->en = !!(pdata->reg_data.constraints.boot_on); max8952->en = !!(pdata->reg_data.constraints.boot_on);
max8952->vid0 = (pdata->default_mode % 2) == 1; max8952->vid0 = (pdata->default_mode % 2) == 1;
...@@ -309,6 +311,10 @@ static int __devinit max8952_pmic_probe(struct i2c_client *client, ...@@ -309,6 +311,10 @@ static int __devinit max8952_pmic_probe(struct i2c_client *client,
i2c_set_clientdata(client, max8952); i2c_set_clientdata(client, max8952);
return 0;
err_reg:
kfree(max8952);
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment