diff options
author | Bibek Basu <bibek.basu@stericsson.com> | 2011-08-17 13:45:01 +0530 |
---|---|---|
committer | Mathieu J. Poirier <mathieu.poirier@linaro.org> | 2011-11-10 11:12:16 -0700 |
commit | 63026f64c623bc071bbddcffee4dd520eb41bc3a (patch) | |
tree | b7184b3e1fbc754d1698d42441c72df8faef2786 /drivers | |
parent | 0ebfd99cd44e1c1e3c13216eaff0a2732bbc9bf3 (diff) |
ux500_ing05160_ab5500_sim_0.1: fix the resource leak
Commit id : I70c297af: staging ab5500-sim: fix the resource leak
Build and boot test only done for 8500 config
Booting will only happend properly if used
Initramfs
Signed-off-by: Bibek Basu <bibek.basu@stericsson.com>
Change-Id: I8edbdb1dbf4282b8bfa4e6b5a3f4b0ca2b460138
Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/28916
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/staging/ab5500_sim/ab5500-sim.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/drivers/staging/ab5500_sim/ab5500-sim.c b/drivers/staging/ab5500_sim/ab5500-sim.c index 788a7984a46..3f4ae7cd34a 100644 --- a/drivers/staging/ab5500_sim/ab5500-sim.c +++ b/drivers/staging/ab5500_sim/ab5500-sim.c @@ -230,14 +230,16 @@ static int __devinit ab5500_sim_probe(struct platform_device *pdev) int irq; struct ab5500_sim *di = kzalloc(sizeof(struct ab5500_sim), GFP_KERNEL); - if (!di) - return -ENOMEM; - + if (!di) { + ret = -ENOMEM; + goto error_alloc; + } dev_info(&pdev->dev, "ab5500_sim_driver PROBE\n"); irq = platform_get_irq_byname(pdev, "SIMOFF"); if (irq < 0) { dev_err(&pdev->dev, "Get irq by name failed\n"); - return irq; + ret = irq; + goto exit; } di->irq_base = irq; di->dev = &pdev->dev; @@ -246,13 +248,14 @@ static int __devinit ab5500_sim_probe(struct platform_device *pdev) /* sysfs interface to configure sim reg from user space */ if (sysfs_create_group(&pdev->dev.kobj, &ab5500sim_attr_grp) < 0) { dev_err(&pdev->dev, " Failed creating sysfs group\n"); - return -ENOMEM; + ret = -ENOMEM; + goto error_sysfs; } ret = request_threaded_irq(irq, NULL, ab5500_sim_irq_handler, IRQF_NO_SUSPEND , "ab5500-sim", pdev); if (ret < 0) { dev_err(&pdev->dev, "Request threaded irq failed (%d)\n", ret); - goto exit; + goto error_irq; } /* this is the contiguous irq for sim removal,falling edge */ irq = irq + 1; @@ -261,13 +264,16 @@ static int __devinit ab5500_sim_probe(struct platform_device *pdev) if (ret < 0) { dev_err(&pdev->dev, "Request threaded irq failed (%d)\n", ret); free_irq(--irq, di); - goto exit; + goto error_irq; } return ret; -exit: +error_irq: sysfs_remove_group(&pdev->dev.kobj, &ab5500sim_attr_grp); +error_sysfs: platform_set_drvdata(pdev, NULL); +exit: kfree(di); +error_alloc: return ret; } |