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>
This commit is contained in:
Родитель
f0094958d9
Коммит
bc67ea8e92
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче