diff options
author | Jingoo Han <jg1.han@samsung.com> | 2013-03-11 02:31:59 -0400 |
---|---|---|
committer | Anton Vorontsov <anton@enomsg.org> | 2013-04-01 02:25:51 -0400 |
commit | bc67ea8e92d45d1237e289fd1c1ec004a8383ccc (patch) | |
tree | 9219227feaf042216c53be4afd611f30c15a8bc2 /drivers/power | |
parent | f0094958d9011d03e688251f8a9510e43a9323f6 (diff) |
da9030_battery: Use devm_kzalloc()
Use devm_kzalloc() to make cleanup paths more simple.
Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Anton Vorontsov <anton@enomsg.org>
Diffstat (limited to 'drivers/power')
-rw-r--r-- | drivers/power/da9030_battery.c | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/drivers/power/da9030_battery.c b/drivers/power/da9030_battery.c index e8c5a391a498..ae6c41835ee6 100644 --- a/drivers/power/da9030_battery.c +++ b/drivers/power/da9030_battery.c | |||
@@ -505,7 +505,7 @@ static int da9030_battery_probe(struct platform_device *pdev) | |||
505 | pdata->charge_millivolt > 4350) | 505 | pdata->charge_millivolt > 4350) |
506 | return -EINVAL; | 506 | return -EINVAL; |
507 | 507 | ||
508 | charger = kzalloc(sizeof(*charger), GFP_KERNEL); | 508 | charger = devm_kzalloc(&pdev->dev, sizeof(*charger), GFP_KERNEL); |
509 | if (charger == NULL) | 509 | if (charger == NULL) |
510 | return -ENOMEM; | 510 | return -ENOMEM; |
511 | 511 | ||
@@ -557,8 +557,6 @@ err_notifier: | |||
557 | cancel_delayed_work(&charger->work); | 557 | cancel_delayed_work(&charger->work); |
558 | 558 | ||
559 | err_charger_init: | 559 | err_charger_init: |
560 | kfree(charger); | ||
561 | |||
562 | return ret; | 560 | return ret; |
563 | } | 561 | } |
564 | 562 | ||
@@ -575,8 +573,6 @@ static int da9030_battery_remove(struct platform_device *dev) | |||
575 | da9030_set_charge(charger, 0); | 573 | da9030_set_charge(charger, 0); |
576 | power_supply_unregister(&charger->psy); | 574 | power_supply_unregister(&charger->psy); |
577 | 575 | ||
578 | kfree(charger); | ||
579 | |||
580 | return 0; | 576 | return 0; |
581 | } | 577 | } |
582 | 578 | ||