aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator/max8952.c
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@gmail.com>2012-05-16 00:50:47 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-05-16 04:48:37 -0400
commit372de4aa5e27af81ac4ce3b7be264e36a1d70a01 (patch)
treea62d781eed7096eac9aa6ed6367cb2d08dba702e /drivers/regulator/max8952.c
parentdde2b724e6bd6a6ea8516345398d3b8fe06a031b (diff)
regulator: max8952: Use devm_kzalloc
Signed-off-by: Axel Lin <axel.lin@gmail.com> Acked-by: MyungJoo Ham <myungjoo.ham@samsung.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/regulator/max8952.c')
-rw-r--r--drivers/regulator/max8952.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/drivers/regulator/max8952.c b/drivers/regulator/max8952.c
index 62ae140d8d9f..910c9b26d499 100644
--- a/drivers/regulator/max8952.c
+++ b/drivers/regulator/max8952.c
@@ -181,7 +181,8 @@ static int __devinit max8952_pmic_probe(struct i2c_client *client,
181 if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE)) 181 if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE))
182 return -EIO; 182 return -EIO;
183 183
184 max8952 = kzalloc(sizeof(struct max8952_data), GFP_KERNEL); 184 max8952 = devm_kzalloc(&client->dev, sizeof(struct max8952_data),
185 GFP_KERNEL);
185 if (!max8952) 186 if (!max8952)
186 return -ENOMEM; 187 return -ENOMEM;
187 188
@@ -198,7 +199,7 @@ static int __devinit max8952_pmic_probe(struct i2c_client *client,
198 if (IS_ERR(max8952->rdev)) { 199 if (IS_ERR(max8952->rdev)) {
199 ret = PTR_ERR(max8952->rdev); 200 ret = PTR_ERR(max8952->rdev);
200 dev_err(max8952->dev, "regulator init failed (%d)\n", ret); 201 dev_err(max8952->dev, "regulator init failed (%d)\n", ret);
201 goto err_reg; 202 return ret;
202 } 203 }
203 204
204 max8952->en = !!(pdata->reg_data.constraints.boot_on); 205 max8952->en = !!(pdata->reg_data.constraints.boot_on);
@@ -295,10 +296,6 @@ static int __devinit max8952_pmic_probe(struct i2c_client *client,
295 i2c_set_clientdata(client, max8952); 296 i2c_set_clientdata(client, max8952);
296 297
297 return 0; 298 return 0;
298
299err_reg:
300 kfree(max8952);
301 return ret;
302} 299}
303 300
304static int __devexit max8952_pmic_remove(struct i2c_client *client) 301static int __devexit max8952_pmic_remove(struct i2c_client *client)
@@ -312,8 +309,6 @@ static int __devexit max8952_pmic_remove(struct i2c_client *client)
312 gpio_free(pdata->gpio_vid0); 309 gpio_free(pdata->gpio_vid0);
313 gpio_free(pdata->gpio_vid1); 310 gpio_free(pdata->gpio_vid1);
314 gpio_free(pdata->gpio_en); 311 gpio_free(pdata->gpio_en);
315
316 kfree(max8952);
317 return 0; 312 return 0;
318} 313}
319 314