summaryrefslogtreecommitdiff
path: root/drivers/power/supply/ab8500_fg.c
diff options
context:
space:
mode:
authorKrzysztof Kozlowski <krzk@kernel.org>2019-10-04 18:07:38 +0300
committerSebastian Reichel <sre@kernel.org>2019-10-20 16:18:44 +0300
commitb10e97003d28f6c83edd79e17dfec91acfbb7377 (patch)
tree94c8d7ada292b18dd8def67c664c488636aebd55 /drivers/power/supply/ab8500_fg.c
parent24108993278d67174a61f9ead38d4d9d1c001a14 (diff)
downloadlinux-b10e97003d28f6c83edd79e17dfec91acfbb7377.tar.xz
power: supply: ab8500: Handle invalid IRQ from platform_get_irq_byname()
platform_get_irq_byname() might return -errno which later would be cast to an unsigned int and used in request_irq(). 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.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/power/supply/ab8500_fg.c b/drivers/power/supply/ab8500_fg.c
index 8a81728749eb..c3912ee9eb99 100644
--- a/drivers/power/supply/ab8500_fg.c
+++ b/drivers/power/supply/ab8500_fg.c
@@ -3158,6 +3158,11 @@ static int ab8500_fg_probe(struct platform_device *pdev)
/* Register primary interrupt handlers */
for (i = 0; i < ARRAY_SIZE(ab8500_fg_irq_th); i++) {
irq = platform_get_irq_byname(pdev, ab8500_fg_irq_th[i].name);
+ if (irq < 0) {
+ ret = irq;
+ goto free_irq_th;
+ }
+
ret = request_irq(irq, ab8500_fg_irq_th[i].isr,
IRQF_SHARED | IRQF_NO_SUSPEND,
ab8500_fg_irq_th[i].name, di);
@@ -3173,6 +3178,11 @@ static int ab8500_fg_probe(struct platform_device *pdev)
/* Register threaded interrupt handler */
irq = platform_get_irq_byname(pdev, ab8500_fg_irq_bh[0].name);
+ if (irq < 0) {
+ ret = irq;
+ goto free_irq_th;
+ }
+
ret = request_threaded_irq(irq, NULL, ab8500_fg_irq_bh[0].isr,
IRQF_SHARED | IRQF_NO_SUSPEND | IRQF_ONESHOT,
ab8500_fg_irq_bh[0].name, di);