Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

da9052-battery: 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>

authored by

Jingoo Han and committed by
Anton Vorontsov
f0094958 4ec730dc

+2 -3
+2 -3
drivers/power/da9052-battery.c
··· 594 594 int ret; 595 595 int i; 596 596 597 - bat = kzalloc(sizeof(struct da9052_battery), GFP_KERNEL); 597 + bat = devm_kzalloc(&pdev->dev, sizeof(struct da9052_battery), 598 + GFP_KERNEL); 598 599 if (!bat) 599 600 return -ENOMEM; 600 601 ··· 636 635 while (--i >= 0) 637 636 da9052_free_irq(bat->da9052, da9052_bat_irq_bits[i], bat); 638 637 639 - kfree(bat); 640 638 return ret; 641 639 } 642 640 static int da9052_bat_remove(struct platform_device *pdev) ··· 647 647 da9052_free_irq(bat->da9052, da9052_bat_irq_bits[i], bat); 648 648 649 649 power_supply_unregister(&bat->psy); 650 - kfree(bat); 651 650 652 651 return 0; 653 652 }