diff options
author | Jingoo Han <jg1.han@samsung.com> | 2013-03-11 02:35:58 -0400 |
---|---|---|
committer | Anton Vorontsov <anton@enomsg.org> | 2013-04-01 02:25:30 -0400 |
commit | b852ac51e25789846cb6257e737a9a1734a0d171 (patch) | |
tree | 60f6ffd50cb00da4d8f8353d12b637a93e6facd0 /drivers/power | |
parent | 3f8060a5fe1825dce3bf9870f4bef964fe6374c9 (diff) |
rx51_battery: 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/rx51_battery.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/power/rx51_battery.c b/drivers/power/rx51_battery.c index 8208888b844e..f9dc9ffd5f97 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) | |||
202 | struct rx51_device_info *di; | 202 | struct rx51_device_info *di; |
203 | int ret; | 203 | int ret; |
204 | 204 | ||
205 | di = kzalloc(sizeof(*di), GFP_KERNEL); | 205 | di = devm_kzalloc(&pdev->dev, sizeof(*di), GFP_KERNEL); |
206 | if (!di) | 206 | if (!di) |
207 | return -ENOMEM; | 207 | return -ENOMEM; |
208 | 208 | ||
@@ -217,7 +217,6 @@ static int rx51_battery_probe(struct platform_device *pdev) | |||
217 | ret = power_supply_register(di->dev, &di->bat); | 217 | ret = power_supply_register(di->dev, &di->bat); |
218 | if (ret) { | 218 | if (ret) { |
219 | platform_set_drvdata(pdev, NULL); | 219 | platform_set_drvdata(pdev, NULL); |
220 | kfree(di); | ||
221 | return ret; | 220 | return ret; |
222 | } | 221 | } |
223 | 222 | ||
@@ -230,7 +229,6 @@ static int rx51_battery_remove(struct platform_device *pdev) | |||
230 | 229 | ||
231 | power_supply_unregister(&di->bat); | 230 | power_supply_unregister(&di->bat); |
232 | platform_set_drvdata(pdev, NULL); | 231 | platform_set_drvdata(pdev, NULL); |
233 | kfree(di); | ||
234 | 232 | ||
235 | return 0; | 233 | return 0; |
236 | } | 234 | } |