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

da9052-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 4ec730dc
...@@ -594,7 +594,8 @@ static s32 da9052_bat_probe(struct platform_device *pdev) ...@@ -594,7 +594,8 @@ static s32 da9052_bat_probe(struct platform_device *pdev)
int ret; int ret;
int i; int i;
bat = kzalloc(sizeof(struct da9052_battery), GFP_KERNEL); bat = devm_kzalloc(&pdev->dev, sizeof(struct da9052_battery),
GFP_KERNEL);
if (!bat) if (!bat)
return -ENOMEM; return -ENOMEM;
...@@ -635,7 +636,6 @@ static s32 da9052_bat_probe(struct platform_device *pdev) ...@@ -635,7 +636,6 @@ static s32 da9052_bat_probe(struct platform_device *pdev)
while (--i >= 0) while (--i >= 0)
da9052_free_irq(bat->da9052, da9052_bat_irq_bits[i], bat); da9052_free_irq(bat->da9052, da9052_bat_irq_bits[i], bat);
kfree(bat);
return ret; return ret;
} }
static int da9052_bat_remove(struct platform_device *pdev) static int da9052_bat_remove(struct platform_device *pdev)
...@@ -647,7 +647,6 @@ static int da9052_bat_remove(struct platform_device *pdev) ...@@ -647,7 +647,6 @@ static int da9052_bat_remove(struct platform_device *pdev)
da9052_free_irq(bat->da9052, da9052_bat_irq_bits[i], bat); da9052_free_irq(bat->da9052, da9052_bat_irq_bits[i], bat);
power_supply_unregister(&bat->psy); power_supply_unregister(&bat->psy);
kfree(bat);
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