diff options
author | Jingoo Han <jg1.han@samsung.com> | 2013-03-11 15:32:18 +0900 |
---|---|---|
committer | Anton Vorontsov <anton@enomsg.org> | 2013-03-31 23:25:49 -0700 |
commit | f0094958d9011d03e688251f8a9510e43a9323f6 (patch) | |
tree | 2926c58d0edca5fa0fa3951b2b5dbc83e19ab667 | |
parent | 4ec730dc8c697d991b9ba8910cb3f8d985016bec (diff) | |
download | op-kernel-dev-f0094958d9011d03e688251f8a9510e43a9323f6.zip op-kernel-dev-f0094958d9011d03e688251f8a9510e43a9323f6.tar.gz |
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>
-rw-r--r-- | drivers/power/da9052-battery.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/power/da9052-battery.c b/drivers/power/da9052-battery.c index 08193fe..f8f4c0f 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) int ret; int i; - bat = kzalloc(sizeof(struct da9052_battery), GFP_KERNEL); + bat = devm_kzalloc(&pdev->dev, sizeof(struct da9052_battery), + GFP_KERNEL); if (!bat) return -ENOMEM; @@ -635,7 +636,6 @@ err: while (--i >= 0) da9052_free_irq(bat->da9052, da9052_bat_irq_bits[i], bat); - kfree(bat); return ret; } 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); power_supply_unregister(&bat->psy); - kfree(bat); return 0; } |