From b852ac51e25789846cb6257e737a9a1734a0d171 Mon Sep 17 00:00:00 2001 From: Jingoo Han Date: Mon, 11 Mar 2013 15:35:58 +0900 Subject: rx51_battery: Use devm_kzalloc() Use devm_kzalloc() to make cleanup paths more simple. Signed-off-by: Jingoo Han Signed-off-by: Anton Vorontsov --- drivers/power/rx51_battery.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/power/rx51_battery.c b/drivers/power/rx51_battery.c index 8208888b844..f9dc9ffd5f9 100644 --- a/drivers/power/rx51_battery.c +++ b/drivers/power/rx51_battery.c @@ -202,7 +202,7 @@ static int rx51_battery_probe(struct platform_device *pdev) struct rx51_device_info *di; int ret; - di = kzalloc(sizeof(*di), GFP_KERNEL); + di = devm_kzalloc(&pdev->dev, sizeof(*di), GFP_KERNEL); if (!di) return -ENOMEM; @@ -217,7 +217,6 @@ static int rx51_battery_probe(struct platform_device *pdev) ret = power_supply_register(di->dev, &di->bat); if (ret) { platform_set_drvdata(pdev, NULL); - kfree(di); return ret; } @@ -230,7 +229,6 @@ static int rx51_battery_remove(struct platform_device *pdev) power_supply_unregister(&di->bat); platform_set_drvdata(pdev, NULL); - kfree(di); return 0; } -- cgit v1.2.3-70-g09d2