From 3241d56edda5cae37cc91b8031d6b52ed69d7eab Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Mon, 26 Mar 2012 09:57:08 +0800 Subject: [PATCH] misc: Fix irq leak in max8997_muic_probe error path Current code does not properly free allocated irqs if request_threaded_irq returns error, fix it. Signed-off-by: Axel Lin Acked-by: MyungJoo Ham Acked-by: Arnd Bergmann Signed-off-by: Greg Kroah-Hartman --- drivers/misc/max8997-muic.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/misc/max8997-muic.c b/drivers/misc/max8997-muic.c index 19591eaa492a..2e7df9c56491 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: -- GitLab