mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-11-26 11:34:42 +08:00
isp1704_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
f3f66b3ea4
commit
2a2ce52a40
@ -411,7 +411,7 @@ static int isp1704_charger_probe(struct platform_device *pdev)
|
||||
struct isp1704_charger *isp;
|
||||
int ret = -ENODEV;
|
||||
|
||||
isp = kzalloc(sizeof *isp, GFP_KERNEL);
|
||||
isp = devm_kzalloc(&pdev->dev, sizeof(*isp), GFP_KERNEL);
|
||||
if (!isp)
|
||||
return -ENOMEM;
|
||||
|
||||
@ -477,8 +477,6 @@ fail1:
|
||||
isp1704_charger_set_power(isp, 0);
|
||||
usb_put_phy(isp->phy);
|
||||
fail0:
|
||||
kfree(isp);
|
||||
|
||||
dev_err(&pdev->dev, "failed to register isp1704 with error %d\n", ret);
|
||||
|
||||
return ret;
|
||||
@ -492,7 +490,6 @@ static int isp1704_charger_remove(struct platform_device *pdev)
|
||||
power_supply_unregister(&isp->psy);
|
||||
usb_put_phy(isp->phy);
|
||||
isp1704_charger_set_power(isp, 0);
|
||||
kfree(isp);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user