diff options
author | Jingoo Han <jg1.han@samsung.com> | 2013-03-11 02:31:39 -0400 |
---|---|---|
committer | Anton Vorontsov <anton@enomsg.org> | 2013-04-01 02:25:53 -0400 |
commit | feeb3a92b1f4e4b53bbad2b1c0d0eb1bcdd6d5a7 (patch) | |
tree | 64f29d479e2994254abe155ed6111ed355462707 /drivers/power/max8925_power.c | |
parent | bc67ea8e92d45d1237e289fd1c1ec004a8383ccc (diff) |
max8925_power: 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/max8925_power.c')
-rw-r--r-- | drivers/power/max8925_power.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/power/max8925_power.c b/drivers/power/max8925_power.c index 665cdc76c265..0ee1e14f76e9 100644 --- a/drivers/power/max8925_power.c +++ b/drivers/power/max8925_power.c | |||
@@ -489,7 +489,8 @@ static int max8925_power_probe(struct platform_device *pdev) | |||
489 | return -EINVAL; | 489 | return -EINVAL; |
490 | } | 490 | } |
491 | 491 | ||
492 | info = kzalloc(sizeof(struct max8925_power_info), GFP_KERNEL); | 492 | info = devm_kzalloc(&pdev->dev, sizeof(struct max8925_power_info), |
493 | GFP_KERNEL); | ||
493 | if (!info) | 494 | if (!info) |
494 | return -ENOMEM; | 495 | return -ENOMEM; |
495 | info->chip = chip; | 496 | info->chip = chip; |
@@ -546,7 +547,6 @@ out_battery: | |||
546 | out_usb: | 547 | out_usb: |
547 | power_supply_unregister(&info->ac); | 548 | power_supply_unregister(&info->ac); |
548 | out: | 549 | out: |
549 | kfree(info); | ||
550 | return ret; | 550 | return ret; |
551 | } | 551 | } |
552 | 552 | ||
@@ -559,7 +559,6 @@ static int max8925_power_remove(struct platform_device *pdev) | |||
559 | power_supply_unregister(&info->usb); | 559 | power_supply_unregister(&info->usb); |
560 | power_supply_unregister(&info->battery); | 560 | power_supply_unregister(&info->battery); |
561 | max8925_deinit_charger(info); | 561 | max8925_deinit_charger(info); |
562 | kfree(info); | ||
563 | } | 562 | } |
564 | return 0; | 563 | return 0; |
565 | } | 564 | } |