aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator/tps65023-regulator.c
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@gmail.com>2012-04-07 11:31:44 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-04-10 06:04:27 -0400
commit19a8da2187249c02574ccffaf72637eb224d11c4 (patch)
treed851e2dd4fe09d3af79451c94c174ebf71f0af3c /drivers/regulator/tps65023-regulator.c
parent9a4bdd87a29bf297d9046410b011d726d51c3999 (diff)
regulator: tps65023: Use devm_* APIs
Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/regulator/tps65023-regulator.c')
-rw-r--r--drivers/regulator/tps65023-regulator.c14
1 files changed, 3 insertions, 11 deletions
diff --git a/drivers/regulator/tps65023-regulator.c b/drivers/regulator/tps65023-regulator.c
index 7755afeecede..2db71497b741 100644
--- a/drivers/regulator/tps65023-regulator.c
+++ b/drivers/regulator/tps65023-regulator.c
@@ -394,16 +394,16 @@ static int __devinit tps_65023_probe(struct i2c_client *client,
394 if (!init_data) 394 if (!init_data)
395 return -EIO; 395 return -EIO;
396 396
397 tps = kzalloc(sizeof(*tps), GFP_KERNEL); 397 tps = devm_kzalloc(&client->dev, sizeof(*tps), GFP_KERNEL);
398 if (!tps) 398 if (!tps)
399 return -ENOMEM; 399 return -ENOMEM;
400 400
401 tps->regmap = regmap_init_i2c(client, &tps65023_regmap_config); 401 tps->regmap = devm_regmap_init_i2c(client, &tps65023_regmap_config);
402 if (IS_ERR(tps->regmap)) { 402 if (IS_ERR(tps->regmap)) {
403 error = PTR_ERR(tps->regmap); 403 error = PTR_ERR(tps->regmap);
404 dev_err(&client->dev, "Failed to allocate register map: %d\n", 404 dev_err(&client->dev, "Failed to allocate register map: %d\n",
405 error); 405 error);
406 goto fail_alloc; 406 return error;
407 } 407 }
408 408
409 /* common for all regulators */ 409 /* common for all regulators */
@@ -449,10 +449,6 @@ static int __devinit tps_65023_probe(struct i2c_client *client,
449 fail: 449 fail:
450 while (--i >= 0) 450 while (--i >= 0)
451 regulator_unregister(tps->rdev[i]); 451 regulator_unregister(tps->rdev[i]);
452
453 regmap_exit(tps->regmap);
454 fail_alloc:
455 kfree(tps);
456 return error; 452 return error;
457} 453}
458 454
@@ -463,10 +459,6 @@ static int __devexit tps_65023_remove(struct i2c_client *client)
463 459
464 for (i = 0; i < TPS65023_NUM_REGULATOR; i++) 460 for (i = 0; i < TPS65023_NUM_REGULATOR; i++)
465 regulator_unregister(tps->rdev[i]); 461 regulator_unregister(tps->rdev[i]);
466
467 regmap_exit(tps->regmap);
468 kfree(tps);
469
470 return 0; 462 return 0;
471} 463}
472 464