[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-id: <007701ce1e22$56dcb7f0$049627d0$%han@samsung.com>
Date: Mon, 11 Mar 2013 15:33:27 +0900
From: Jingoo Han <jg1.han@...sung.com>
To: 'Anton Vorontsov' <anton@...msg.org>
Cc: 'David Woodhouse' <dwmw2@...radead.org>,
linux-kernel@...r.kernel.org, 'Jingoo Han' <jg1.han@...sung.com>
Subject: [PATCH 07/14] power: gpio-charger: use devm_kzalloc()
Use devm_kzalloc() to make cleanup paths more simple.
Signed-off-by: Jingoo Han <jg1.han@...sung.com>
---
drivers/power/gpio-charger.c | 5 ++---
1 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/power/gpio-charger.c b/drivers/power/gpio-charger.c
index e3e40a9..e9883ee 100644
--- a/drivers/power/gpio-charger.c
+++ b/drivers/power/gpio-charger.c
@@ -86,7 +86,8 @@ static int gpio_charger_probe(struct platform_device *pdev)
return -EINVAL;
}
- gpio_charger = kzalloc(sizeof(*gpio_charger), GFP_KERNEL);
+ gpio_charger = devm_kzalloc(&pdev->dev, sizeof(*gpio_charger),
+ GFP_KERNEL);
if (!gpio_charger) {
dev_err(&pdev->dev, "Failed to alloc driver structure\n");
return -ENOMEM;
@@ -140,7 +141,6 @@ static int gpio_charger_probe(struct platform_device *pdev)
err_gpio_free:
gpio_free(pdata->gpio);
err_free:
- kfree(gpio_charger);
return ret;
}
@@ -156,7 +156,6 @@ static int gpio_charger_remove(struct platform_device *pdev)
gpio_free(gpio_charger->pdata->gpio);
platform_set_drvdata(pdev, NULL);
- kfree(gpio_charger);
return 0;
}
--
1.7.2.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists