diff options
author | Lee Jones <lee.jones@linaro.org> | 2013-05-23 11:25:12 -0400 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2013-06-13 06:11:43 -0400 |
commit | 58645b36b2ce0a3468e4fd445578227797c56d81 (patch) | |
tree | 95d0b569920a3242a1c87dbcdaf4c821d2eeb2e4 | |
parent | 099053a497638a928dac278bd95f192220c3cde1 (diff) |
mfd: htc-egpio: Convert to managed resources for allocating memory
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
-rw-r--r-- | drivers/mfd/htc-egpio.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/drivers/mfd/htc-egpio.c b/drivers/mfd/htc-egpio.c index bbaec0ccba8f..f2e0ad4b332e 100644 --- a/drivers/mfd/htc-egpio.c +++ b/drivers/mfd/htc-egpio.c | |||
@@ -270,7 +270,7 @@ static int __init egpio_probe(struct platform_device *pdev) | |||
270 | int ret; | 270 | int ret; |
271 | 271 | ||
272 | /* Initialize ei data structure. */ | 272 | /* Initialize ei data structure. */ |
273 | ei = kzalloc(sizeof(*ei), GFP_KERNEL); | 273 | ei = devm_kzalloc(&pdev->dev, sizeof(*ei), GFP_KERNEL); |
274 | if (!ei) | 274 | if (!ei) |
275 | return -ENOMEM; | 275 | return -ENOMEM; |
276 | 276 | ||
@@ -306,7 +306,9 @@ static int __init egpio_probe(struct platform_device *pdev) | |||
306 | platform_set_drvdata(pdev, ei); | 306 | platform_set_drvdata(pdev, ei); |
307 | 307 | ||
308 | ei->nchips = pdata->num_chips; | 308 | ei->nchips = pdata->num_chips; |
309 | ei->chip = kzalloc(sizeof(struct egpio_chip) * ei->nchips, GFP_KERNEL); | 309 | ei->chip = devm_kzalloc(&pdev->dev, |
310 | sizeof(struct egpio_chip) * ei->nchips, | ||
311 | GFP_KERNEL); | ||
310 | if (!ei->chip) { | 312 | if (!ei->chip) { |
311 | ret = -ENOMEM; | 313 | ret = -ENOMEM; |
312 | goto fail; | 314 | goto fail; |
@@ -361,7 +363,6 @@ static int __init egpio_probe(struct platform_device *pdev) | |||
361 | 363 | ||
362 | fail: | 364 | fail: |
363 | printk(KERN_ERR "EGPIO failed to setup\n"); | 365 | printk(KERN_ERR "EGPIO failed to setup\n"); |
364 | kfree(ei); | ||
365 | return ret; | 366 | return ret; |
366 | } | 367 | } |
367 | 368 | ||
@@ -380,8 +381,6 @@ static int __exit egpio_remove(struct platform_device *pdev) | |||
380 | device_init_wakeup(&pdev->dev, 0); | 381 | device_init_wakeup(&pdev->dev, 0); |
381 | } | 382 | } |
382 | iounmap(ei->base_addr); | 383 | iounmap(ei->base_addr); |
383 | kfree(ei->chip); | ||
384 | kfree(ei); | ||
385 | 384 | ||
386 | return 0; | 385 | return 0; |
387 | } | 386 | } |