summaryrefslogtreecommitdiff
path: root/drivers/mfd
diff options
context:
space:
mode:
authorLee Jones <lee.jones@linaro.org>2013-05-23 19:25:12 +0400
committerSamuel Ortiz <sameo@linux.intel.com>2013-06-13 14:11:43 +0400
commit58645b36b2ce0a3468e4fd445578227797c56d81 (patch)
tree95d0b569920a3242a1c87dbcdaf4c821d2eeb2e4 /drivers/mfd
parent099053a497638a928dac278bd95f192220c3cde1 (diff)
downloadlinux-58645b36b2ce0a3468e4fd445578227797c56d81.tar.xz
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>
Diffstat (limited to 'drivers/mfd')
-rw-r--r--drivers/mfd/htc-egpio.c9
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)
int ret;
/* Initialize ei data structure. */
- ei = kzalloc(sizeof(*ei), GFP_KERNEL);
+ ei = devm_kzalloc(&pdev->dev, sizeof(*ei), GFP_KERNEL);
if (!ei)
return -ENOMEM;
@@ -306,7 +306,9 @@ static int __init egpio_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, ei);
ei->nchips = pdata->num_chips;
- ei->chip = kzalloc(sizeof(struct egpio_chip) * ei->nchips, GFP_KERNEL);
+ ei->chip = devm_kzalloc(&pdev->dev,
+ sizeof(struct egpio_chip) * ei->nchips,
+ GFP_KERNEL);
if (!ei->chip) {
ret = -ENOMEM;
goto fail;
@@ -361,7 +363,6 @@ static int __init egpio_probe(struct platform_device *pdev)
fail:
printk(KERN_ERR "EGPIO failed to setup\n");
- kfree(ei);
return ret;
}
@@ -380,8 +381,6 @@ static int __exit egpio_remove(struct platform_device *pdev)
device_init_wakeup(&pdev->dev, 0);
}
iounmap(ei->base_addr);
- kfree(ei->chip);
- kfree(ei);
return 0;
}