]> git.karo-electronics.de Git - linux-beck.git/commitdiff
misc: Fix irq leak in max8997_muic_probe error path
authorAxel Lin <axel.lin@gmail.com>
Mon, 26 Mar 2012 01:57:08 +0000 (09:57 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 18 Apr 2012 21:52:40 +0000 (14:52 -0700)
Current code does not properly free allocated irqs if request_threaded_irq
returns error, fix it.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/misc/max8997-muic.c

index 19591eaa492a1d8292d37ab5430c69802f6b017d..2e7df9c56491b6b8452b5e33ce17524a3716ec0d 100644 (file)
@@ -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: