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

max8998_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 c09dd7da
...@@ -88,7 +88,8 @@ static int max8998_battery_probe(struct platform_device *pdev) ...@@ -88,7 +88,8 @@ static int max8998_battery_probe(struct platform_device *pdev)
return -ENODEV; return -ENODEV;
} }
max8998 = kzalloc(sizeof(struct max8998_battery_data), GFP_KERNEL); max8998 = devm_kzalloc(&pdev->dev, sizeof(struct max8998_battery_data),
GFP_KERNEL);
if (!max8998) if (!max8998)
return -ENOMEM; return -ENOMEM;
...@@ -174,7 +175,6 @@ static int max8998_battery_probe(struct platform_device *pdev) ...@@ -174,7 +175,6 @@ static int max8998_battery_probe(struct platform_device *pdev)
return 0; return 0;
err: err:
kfree(max8998);
return ret; return ret;
} }
...@@ -183,7 +183,6 @@ static int max8998_battery_remove(struct platform_device *pdev) ...@@ -183,7 +183,6 @@ static int max8998_battery_remove(struct platform_device *pdev)
struct max8998_battery_data *max8998 = platform_get_drvdata(pdev); struct max8998_battery_data *max8998 = platform_get_drvdata(pdev);
power_supply_unregister(&max8998->battery); power_supply_unregister(&max8998->battery);
kfree(max8998);
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