[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20191004150738.6542-2-krzk@kernel.org>
Date: Fri, 4 Oct 2019 17:07:37 +0200
From: Krzysztof Kozlowski <krzk@...nel.org>
To: Sebastian Reichel <sre@...nel.org>,
Krzysztof Kozlowski <krzk@...nel.org>,
"Gustavo A. R. Silva" <gustavo@...eddedor.com>,
Linus Walleij <linus.walleij@...aro.org>,
linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [RFT 2/3] 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@...nel.org>
---
Not marking as cc-stable as this was not reproduced and not tested.
---
drivers/power/supply/ab8500_fg.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/power/supply/ab8500_fg.c b/drivers/power/supply/ab8500_fg.c
index 36bbb8ea05da..7d879589adc2 100644
--- a/drivers/power/supply/ab8500_fg.c
+++ b/drivers/power/supply/ab8500_fg.c
@@ -3158,7 +3158,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);
@@ -3173,7 +3173,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);
@@ -3215,7 +3215,9 @@ static int ab8500_fg_probe(struct platform_device *pdev)
/* 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);
}
--
2.17.1
Powered by blists - more mailing lists