diff options
author | Krzysztof Kozlowski <krzk@kernel.org> | 2019-10-04 17:07:37 +0200 |
---|---|---|
committer | Sebastian Reichel <sre@kernel.org> | 2019-10-20 15:18:08 +0200 |
commit | 24108993278d67174a61f9ead38d4d9d1c001a14 (patch) | |
tree | 5e048ccde3483bc6542e2ed41b7274afeead1b23 /drivers/power/supply/ab8500_fg.c | |
parent | ccc023a58175565b91f6d1996cde4dfe93b04808 (diff) |
power: supply: ab8500_fg: Do not free non-requested IRQs in probe's error path
When requesting interrupt fails, free only interrupts already requested,
not all of them.
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Diffstat (limited to 'drivers/power/supply/ab8500_fg.c')
-rw-r--r-- | drivers/power/supply/ab8500_fg.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/power/supply/ab8500_fg.c b/drivers/power/supply/ab8500_fg.c index 015f4676e2ba..8a81728749eb 100644 --- a/drivers/power/supply/ab8500_fg.c +++ b/drivers/power/supply/ab8500_fg.c @@ -3165,7 +3165,7 @@ static int ab8500_fg_probe(struct platform_device *pdev) if (ret != 0) { dev_err(di->dev, "failed to request %s IRQ %d: %d\n", ab8500_fg_irq_th[i].name, irq, ret); - goto free_irq; + goto free_irq_th; } dev_dbg(di->dev, "Requested %s IRQ %d: %d\n", ab8500_fg_irq_th[i].name, irq, ret); @@ -3180,7 +3180,7 @@ static int ab8500_fg_probe(struct platform_device *pdev) if (ret != 0) { dev_err(di->dev, "failed to request %s IRQ %d: %d\n", ab8500_fg_irq_bh[0].name, irq, ret); - goto free_irq; + goto free_irq_th; } dev_dbg(di->dev, "Requested %s IRQ %d: %d\n", ab8500_fg_irq_bh[0].name, irq, ret); @@ -3222,7 +3222,9 @@ free_irq: /* We also have to free all registered irqs */ irq = platform_get_irq_byname(pdev, ab8500_fg_irq_bh[0].name); free_irq(irq, di); - for (i = 0; i < ARRAY_SIZE(ab8500_fg_irq_th); i++) { +free_irq_th: + while (--i >= 0) { + /* Last assignment of i from primary interrupt handlers */ irq = platform_get_irq_byname(pdev, ab8500_fg_irq_th[i].name); free_irq(irq, di); } |