mirror of
https://github.com/torvalds/linux.git
synced 2024-12-29 06:12:08 +00:00
max8903_charger: 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:
parent
d4a20f57d3
commit
f3f66b3ea4
@ -189,7 +189,7 @@ static int max8903_probe(struct platform_device *pdev)
|
|||||||
int ta_in = 0;
|
int ta_in = 0;
|
||||||
int usb_in = 0;
|
int usb_in = 0;
|
||||||
|
|
||||||
data = kzalloc(sizeof(struct max8903_data), GFP_KERNEL);
|
data = devm_kzalloc(dev, sizeof(struct max8903_data), GFP_KERNEL);
|
||||||
if (data == NULL) {
|
if (data == NULL) {
|
||||||
dev_err(dev, "Cannot allocate memory.\n");
|
dev_err(dev, "Cannot allocate memory.\n");
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
@ -341,7 +341,6 @@ err_dc_irq:
|
|||||||
err_psy:
|
err_psy:
|
||||||
power_supply_unregister(&data->psy);
|
power_supply_unregister(&data->psy);
|
||||||
err:
|
err:
|
||||||
kfree(data);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -359,7 +358,6 @@ static int max8903_remove(struct platform_device *pdev)
|
|||||||
if (pdata->dc_valid)
|
if (pdata->dc_valid)
|
||||||
free_irq(gpio_to_irq(pdata->dok), data);
|
free_irq(gpio_to_irq(pdata->dok), data);
|
||||||
power_supply_unregister(&data->psy);
|
power_supply_unregister(&data->psy);
|
||||||
kfree(data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user