diff options
author | Jingoo Han <jg1.han@samsung.com> | 2013-03-11 10:35:14 +0400 |
---|---|---|
committer | Anton Vorontsov <anton@enomsg.org> | 2013-04-01 10:25:34 +0400 |
commit | acfbf47a903a22d4679137ad04d00194baec6a0c (patch) | |
tree | 99e391e9b5641c1116b341187672b2b2bd419066 /drivers/power/max8998_charger.c | |
parent | c09dd7daba1d0d833075e4ee653ddc4e7f53a7e1 (diff) | |
download | linux-acfbf47a903a22d4679137ad04d00194baec6a0c.tar.xz |
max8998_charger: 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>
Diffstat (limited to 'drivers/power/max8998_charger.c')
-rw-r--r-- | drivers/power/max8998_charger.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/power/max8998_charger.c b/drivers/power/max8998_charger.c index bf677e3daec9..5017470c2fc9 100644 --- a/drivers/power/max8998_charger.c +++ b/drivers/power/max8998_charger.c @@ -88,7 +88,8 @@ static int max8998_battery_probe(struct platform_device *pdev) 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) return -ENOMEM; @@ -174,7 +175,6 @@ static int max8998_battery_probe(struct platform_device *pdev) return 0; err: - kfree(max8998); return ret; } @@ -183,7 +183,6 @@ static int max8998_battery_remove(struct platform_device *pdev) struct max8998_battery_data *max8998 = platform_get_drvdata(pdev); power_supply_unregister(&max8998->battery); - kfree(max8998); return 0; } |