Commit bc67ea8e authored by Jingoo Han's avatar Jingoo Han Committed by Anton Vorontsov

da9030_battery: Use devm_kzalloc()

Use devm_kzalloc() to make cleanup paths more simple.
Signed-off-by: default avatarJingoo Han <jg1.han@samsung.com>
Signed-off-by: default avatarAnton Vorontsov <anton@enomsg.org>
parent f0094958
......@@ -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 @@ static int da9030_battery_probe(struct platform_device *pdev)
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;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment