From: Jingoo Han Date: Mon, 11 Mar 2013 06:31:59 +0000 (+0900) Subject: da9030_battery: Use devm_kzalloc() X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=bc67ea8e92d45d1237e289fd1c1ec004a8383ccc;p=linux-beck.git da9030_battery: Use devm_kzalloc() Use devm_kzalloc() to make cleanup paths more simple. Signed-off-by: Jingoo Han Signed-off-by: Anton Vorontsov --- 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; }