summaryrefslogtreecommitdiff
path: root/drivers/power
diff options
context:
space:
mode:
authorJingoo Han <jg1.han@samsung.com>2013-03-11 10:31:59 +0400
committerAnton Vorontsov <anton@enomsg.org>2013-04-01 10:25:51 +0400
commitbc67ea8e92d45d1237e289fd1c1ec004a8383ccc (patch)
tree9219227feaf042216c53be4afd611f30c15a8bc2 /drivers/power
parentf0094958d9011d03e688251f8a9510e43a9323f6 (diff)
downloadlinux-bc67ea8e92d45d1237e289fd1c1ec004a8383ccc.tar.xz
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.c6
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)
pdata->charge_millivolt > 4350)
return -EINVAL;
- charger = kzalloc(sizeof(*charger), GFP_KERNEL);
+ charger = devm_kzalloc(&pdev->dev, sizeof(*charger), GFP_KERNEL);
if (charger == NULL)
return -ENOMEM;
@@ -557,8 +557,6 @@ err_notifier:
cancel_delayed_work(&charger->work);
err_charger_init:
- kfree(charger);
-
return ret;
}
@@ -575,8 +573,6 @@ static int da9030_battery_remove(struct platform_device *dev)
da9030_set_charge(charger, 0);
power_supply_unregister(&charger->psy);
- kfree(charger);
-
return 0;
}