diff options
author | Jingoo Han <jg1.han@samsung.com> | 2013-03-11 02:33:27 -0400 |
---|---|---|
committer | Anton Vorontsov <anton@enomsg.org> | 2013-04-01 02:25:42 -0400 |
commit | b92ff855b97795d8be3115c0aff04f6efb5a53aa (patch) | |
tree | 07723ea4924d043aad6dd20638cc40c2aaa59a65 /drivers/power | |
parent | 2a2ce52a4006db6c7831f1b21f1b0cc892516e85 (diff) |
gpio-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')
-rw-r--r-- | 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 e3e40a9f3af2..e9883eeeee76 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) | |||
86 | return -EINVAL; | 86 | return -EINVAL; |
87 | } | 87 | } |
88 | 88 | ||
89 | gpio_charger = kzalloc(sizeof(*gpio_charger), GFP_KERNEL); | 89 | gpio_charger = devm_kzalloc(&pdev->dev, sizeof(*gpio_charger), |
90 | GFP_KERNEL); | ||
90 | if (!gpio_charger) { | 91 | if (!gpio_charger) { |
91 | dev_err(&pdev->dev, "Failed to alloc driver structure\n"); | 92 | dev_err(&pdev->dev, "Failed to alloc driver structure\n"); |
92 | return -ENOMEM; | 93 | return -ENOMEM; |
@@ -140,7 +141,6 @@ static int gpio_charger_probe(struct platform_device *pdev) | |||
140 | err_gpio_free: | 141 | err_gpio_free: |
141 | gpio_free(pdata->gpio); | 142 | gpio_free(pdata->gpio); |
142 | err_free: | 143 | err_free: |
143 | kfree(gpio_charger); | ||
144 | return ret; | 144 | return ret; |
145 | } | 145 | } |
146 | 146 | ||
@@ -156,7 +156,6 @@ static int gpio_charger_remove(struct platform_device *pdev) | |||
156 | gpio_free(gpio_charger->pdata->gpio); | 156 | gpio_free(gpio_charger->pdata->gpio); |
157 | 157 | ||
158 | platform_set_drvdata(pdev, NULL); | 158 | platform_set_drvdata(pdev, NULL); |
159 | kfree(gpio_charger); | ||
160 | 159 | ||
161 | return 0; | 160 | return 0; |
162 | } | 161 | } |