summaryrefslogtreecommitdiffstats
path: root/drivers/media/rc/ite-cir.c
diff options
context:
space:
mode:
authorBen Hutchings <ben@decadent.org.uk>2012-05-14 21:36:00 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-05-20 11:43:05 -0300
commitf27b853ea24a9b70585f9251384d97929e6551c3 (patch)
tree3ee3779961fb8356a54156fb472cb4a87ca9473f /drivers/media/rc/ite-cir.c
parent81cda577422b85f98efc350e2520f2a2dc5f3ddb (diff)
downloadblackbird-op-linux-f27b853ea24a9b70585f9251384d97929e6551c3.tar.gz
blackbird-op-linux-f27b853ea24a9b70585f9251384d97929e6551c3.zip
[media] rc: Fix invalid free_region and/or free_irq on probe failure
fintek-cir, ite-cir and nuvoton-cir may try to free an I/O region and/or IRQ handler that was never allocated after a failure in their respective probe functions. Add and use separate labels on the failure path so they will do the right cleanup after each possible point of failure. Compile-tested only. Signed-off-by: Ben Hutchings <ben@decadent.org.uk> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/rc/ite-cir.c')
-rw-r--r--drivers/media/rc/ite-cir.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/drivers/media/rc/ite-cir.c b/drivers/media/rc/ite-cir.c
index 0e49c99abf68..36fe5a349b95 100644
--- a/drivers/media/rc/ite-cir.c
+++ b/drivers/media/rc/ite-cir.c
@@ -1598,24 +1598,22 @@ static int ite_probe(struct pnp_dev *pdev, const struct pnp_device_id
if (request_irq(itdev->cir_irq, ite_cir_isr, IRQF_SHARED,
ITE_DRIVER_NAME, (void *)itdev))
- goto failure;
+ goto failure2;
ret = rc_register_device(rdev);
if (ret)
- goto failure;
+ goto failure3;
itdev->rdev = rdev;
ite_pr(KERN_NOTICE, "driver has been successfully loaded\n");
return 0;
+failure3:
+ free_irq(itdev->cir_irq, itdev);
+failure2:
+ release_region(itdev->cir_addr, itdev->params.io_region_size);
failure:
- if (itdev->cir_irq)
- free_irq(itdev->cir_irq, itdev);
-
- if (itdev->cir_addr)
- release_region(itdev->cir_addr, itdev->params.io_region_size);
-
rc_free_device(rdev);
kfree(itdev);
OpenPOWER on IntegriCloud