diff options
author | Ben Hutchings <ben@decadent.org.uk> | 2012-05-14 20:36:00 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-05-20 10:43:05 -0400 |
commit | f27b853ea24a9b70585f9251384d97929e6551c3 (patch) | |
tree | 3ee3779961fb8356a54156fb472cb4a87ca9473f /drivers/media/rc/fintek-cir.c | |
parent | 81cda577422b85f98efc350e2520f2a2dc5f3ddb (diff) |
[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/fintek-cir.c')
-rw-r--r-- | drivers/media/rc/fintek-cir.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/drivers/media/rc/fintek-cir.c b/drivers/media/rc/fintek-cir.c index 4a3a238bcfbc..6aabf7ae3a31 100644 --- a/drivers/media/rc/fintek-cir.c +++ b/drivers/media/rc/fintek-cir.c | |||
@@ -556,11 +556,11 @@ static int fintek_probe(struct pnp_dev *pdev, const struct pnp_device_id *dev_id | |||
556 | 556 | ||
557 | if (request_irq(fintek->cir_irq, fintek_cir_isr, IRQF_SHARED, | 557 | if (request_irq(fintek->cir_irq, fintek_cir_isr, IRQF_SHARED, |
558 | FINTEK_DRIVER_NAME, (void *)fintek)) | 558 | FINTEK_DRIVER_NAME, (void *)fintek)) |
559 | goto failure; | 559 | goto failure2; |
560 | 560 | ||
561 | ret = rc_register_device(rdev); | 561 | ret = rc_register_device(rdev); |
562 | if (ret) | 562 | if (ret) |
563 | goto failure; | 563 | goto failure3; |
564 | 564 | ||
565 | device_init_wakeup(&pdev->dev, true); | 565 | device_init_wakeup(&pdev->dev, true); |
566 | fintek->rdev = rdev; | 566 | fintek->rdev = rdev; |
@@ -570,12 +570,11 @@ static int fintek_probe(struct pnp_dev *pdev, const struct pnp_device_id *dev_id | |||
570 | 570 | ||
571 | return 0; | 571 | return 0; |
572 | 572 | ||
573 | failure3: | ||
574 | free_irq(fintek->cir_irq, fintek); | ||
575 | failure2: | ||
576 | release_region(fintek->cir_addr, fintek->cir_port_len); | ||
573 | failure: | 577 | failure: |
574 | if (fintek->cir_irq) | ||
575 | free_irq(fintek->cir_irq, fintek); | ||
576 | if (fintek->cir_addr) | ||
577 | release_region(fintek->cir_addr, fintek->cir_port_len); | ||
578 | |||
579 | rc_free_device(rdev); | 578 | rc_free_device(rdev); |
580 | kfree(fintek); | 579 | kfree(fintek); |
581 | 580 | ||