Skip to content

Commit

Permalink
da9052-battery: Don't free IRQ that wasn't requested
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Dan Carpenter authored and Anton Vorontsov committed Sep 20, 2012
1 parent a22b41a commit f4f95ad
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/power/da9052-battery.c
Original file line number Diff line number Diff line change
@@ -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);
}

0 comments on commit f4f95ad

Please sign in to comment.