da9052-battery: Don't free IRQ that wasn't requested
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 5 Sep 2012 12:34:41 +0000 (15:34 +0300)
committerAnton Vorontsov <anton.vorontsov@linaro.org>
Thu, 20 Sep 2012 22:00:12 +0000 (15:00 -0700)
We should decrement "i" before doing the free_irq().  If we call this
because request_threaded_irq() failed then we don't want to free the
thing which failed.  Or in the case where we get here because
power_supply_register() failed then the original codes does a read past
the end of the array.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
drivers/power/da9052-battery.c

index 20b86ed946e3eb2c71f410d0288b3547cf12edee..d9d034d7496f7c3adeaf4af5e0d72bf02f522a7d 100644 (file)
@@ -623,7 +623,7 @@ static s32 __devinit da9052_bat_probe(struct platform_device *pdev)
        return 0;
 
 err:
-       for (; i >= 0; i--) {
+       while (--i >= 0) {
                irq = platform_get_irq_byname(pdev, da9052_bat_irqs[i]);
                free_irq(bat->da9052->irq_base + irq, bat);
        }
This page took 0.044708 seconds and 5 git commands to generate.