aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/power
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/power')
-rw-r--r--drivers/power/da9052-battery.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/power/da9052-battery.c b/drivers/power/da9052-battery.c
index 08193feb3b08..f8f4c0f7c17d 100644
--- a/drivers/power/da9052-battery.c
+++ b/drivers/power/da9052-battery.c
@@ -594,7 +594,8 @@ static s32 da9052_bat_probe(struct platform_device *pdev)
594 int ret; 594 int ret;
595 int i; 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 if (!bat) 599 if (!bat)
599 return -ENOMEM; 600 return -ENOMEM;
600 601
@@ -635,7 +636,6 @@ err:
635 while (--i >= 0) 636 while (--i >= 0)
636 da9052_free_irq(bat->da9052, da9052_bat_irq_bits[i], bat); 637 da9052_free_irq(bat->da9052, da9052_bat_irq_bits[i], bat);
637 638
638 kfree(bat);
639 return ret; 639 return ret;
640} 640}
641static int da9052_bat_remove(struct platform_device *pdev) 641static int da9052_bat_remove(struct platform_device *pdev)
@@ -647,7 +647,6 @@ static int da9052_bat_remove(struct platform_device *pdev)
647 da9052_free_irq(bat->da9052, da9052_bat_irq_bits[i], bat); 647 da9052_free_irq(bat->da9052, da9052_bat_irq_bits[i], bat);
648 648
649 power_supply_unregister(&bat->psy); 649 power_supply_unregister(&bat->psy);
650 kfree(bat);
651 650
652 return 0; 651 return 0;
653} 652}