summaryrefslogtreecommitdiffstats
path: root/drivers/power/da9052-battery.c
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2012-09-05 14:34:41 +0200
committerAnton Vorontsov <anton.vorontsov@linaro.org>2012-09-21 00:00:12 +0200
commitf4f95adf7caa9078e15c55407573208683dcb1b7 (patch)
tree7a3fb12a4ba8a36315c20c6a843c3b45463df189 /drivers/power/da9052-battery.c
parentsbs-battery: Probe should try talking to the device (diff)
downloadlinux-f4f95adf7caa9078e15c55407573208683dcb1b7.tar.xz
linux-f4f95adf7caa9078e15c55407573208683dcb1b7.zip
da9052-battery: Don't free IRQ that wasn't requested
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>
Diffstat (limited to 'drivers/power/da9052-battery.c')
-rw-r--r--drivers/power/da9052-battery.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/power/da9052-battery.c b/drivers/power/da9052-battery.c
index 20b86ed946e3..d9d034d7496f 100644
--- a/drivers/power/da9052-battery.c
+++ b/drivers/power/da9052-battery.c
@@ -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);
}