Commit 2a2ce52a authored by Jingoo Han's avatar Jingoo Han Committed by Anton Vorontsov

isp1704_charger: 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 f3f66b3e
...@@ -411,7 +411,7 @@ static int isp1704_charger_probe(struct platform_device *pdev) ...@@ -411,7 +411,7 @@ static int isp1704_charger_probe(struct platform_device *pdev)
struct isp1704_charger *isp; struct isp1704_charger *isp;
int ret = -ENODEV; int ret = -ENODEV;
isp = kzalloc(sizeof *isp, GFP_KERNEL); isp = devm_kzalloc(&pdev->dev, sizeof(*isp), GFP_KERNEL);
if (!isp) if (!isp)
return -ENOMEM; return -ENOMEM;
...@@ -477,8 +477,6 @@ static int isp1704_charger_probe(struct platform_device *pdev) ...@@ -477,8 +477,6 @@ static int isp1704_charger_probe(struct platform_device *pdev)
isp1704_charger_set_power(isp, 0); isp1704_charger_set_power(isp, 0);
usb_put_phy(isp->phy); usb_put_phy(isp->phy);
fail0: fail0:
kfree(isp);
dev_err(&pdev->dev, "failed to register isp1704 with error %d\n", ret); dev_err(&pdev->dev, "failed to register isp1704 with error %d\n", ret);
return ret; return ret;
...@@ -492,7 +490,6 @@ static int isp1704_charger_remove(struct platform_device *pdev) ...@@ -492,7 +490,6 @@ static int isp1704_charger_remove(struct platform_device *pdev)
power_supply_unregister(&isp->psy); power_supply_unregister(&isp->psy);
usb_put_phy(isp->phy); usb_put_phy(isp->phy);
isp1704_charger_set_power(isp, 0); isp1704_charger_set_power(isp, 0);
kfree(isp);
return 0; 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