[PATCH RESEND] misc: Fix irq leak in max8997_muic_probe error path

From: Axel Lin
Date: Sun Mar 25 2012 - 21:57:50 EST


Current code does not properly free allocated irqs if request_threaded_irq
returns error, fix it.

Signed-off-by: Axel Lin <axel.lin@xxxxxxxxx>
Acked-by: MyungJoo Ham <myungjoo.ham@xxxxxxxxxxx>
---
This patch was sent on LKML:https://lkml.org/lkml/2011/12/17/114
This resend re-generate the patch because it does not apply due to
the change in commit 71e5878 "misc: Remove max8997-muic sysfs attributes".

drivers/misc/max8997-muic.c | 6 ++----
1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/misc/max8997-muic.c b/drivers/misc/max8997-muic.c
index 19591ea..2e7df9c 100644
--- a/drivers/misc/max8997-muic.c
+++ b/drivers/misc/max8997-muic.c
@@ -440,10 +440,6 @@ static int __devinit max8997_muic_probe(struct platform_device *pdev)
"failed: irq request (IRQ: %d,"
" error :%d)\n",
muic_irq->irq, ret);
-
- for (i = i - 1; i >= 0; i--)
- free_irq(muic_irq->irq, info);
-
goto err_irq;
}
}
@@ -457,6 +453,8 @@ static int __devinit max8997_muic_probe(struct platform_device *pdev)
return ret;

err_irq:
+ while (--i >= 0)
+ free_irq(pdata->irq_base + muic_irqs[i].irq, info);
err_pdata:
kfree(info);
err_kfree:
--
1.7.5.4



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/