]> git.karo-electronics.de Git - linux-beck.git/commitdiff
max8925_power: Use devm_kzalloc()
authorJingoo Han <jg1.han@samsung.com>
Mon, 11 Mar 2013 06:31:39 +0000 (15:31 +0900)
committerAnton Vorontsov <anton@enomsg.org>
Mon, 1 Apr 2013 06:25:53 +0000 (23:25 -0700)
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>
drivers/power/max8925_power.c

index 665cdc76c26502e7a207ac8cbfc1dbfb90be5864..0ee1e14f76e9a8957f298cb797fb3243958a0af9 100644 (file)
@@ -489,7 +489,8 @@ static int max8925_power_probe(struct platform_device *pdev)
                return -EINVAL;
        }
 
-       info = kzalloc(sizeof(struct max8925_power_info), GFP_KERNEL);
+       info = devm_kzalloc(&pdev->dev, sizeof(struct max8925_power_info),
+                               GFP_KERNEL);
        if (!info)
                return -ENOMEM;
        info->chip = chip;
@@ -546,7 +547,6 @@ out_battery:
 out_usb:
        power_supply_unregister(&info->ac);
 out:
-       kfree(info);
        return ret;
 }
 
@@ -559,7 +559,6 @@ static int max8925_power_remove(struct platform_device *pdev)
                power_supply_unregister(&info->usb);
                power_supply_unregister(&info->battery);
                max8925_deinit_charger(info);
-               kfree(info);
        }
        return 0;
 }