diff options
author | Krzysztof Kozlowski | 2019-10-04 17:07:38 +0200 |
---|---|---|
committer | Sebastian Reichel | 2019-10-20 15:18:44 +0200 |
commit | b10e97003d28f6c83edd79e17dfec91acfbb7377 (patch) | |
tree | 94c8d7ada292b18dd8def67c664c488636aebd55 /drivers/power | |
parent | 24108993278d67174a61f9ead38d4d9d1c001a14 (diff) |
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')
-rw-r--r-- | drivers/power/supply/ab8500_btemp.c | 5 | ||||
-rw-r--r-- | drivers/power/supply/ab8500_charger.c | 5 | ||||
-rw-r--r-- | drivers/power/supply/ab8500_fg.c | 10 |
3 files changed, 20 insertions, 0 deletions
diff --git a/drivers/power/supply/ab8500_btemp.c b/drivers/power/supply/ab8500_btemp.c index e9f536594770..909f0242bacb 100644 --- a/drivers/power/supply/ab8500_btemp.c +++ b/drivers/power/supply/ab8500_btemp.c @@ -1099,6 +1099,11 @@ static int ab8500_btemp_probe(struct platform_device *pdev) /* Register interrupts */ for (i = 0; i < ARRAY_SIZE(ab8500_btemp_irq); i++) { irq = platform_get_irq_byname(pdev, ab8500_btemp_irq[i].name); + if (irq < 0) { + ret = irq; + goto free_irq; + } + ret = request_threaded_irq(irq, NULL, ab8500_btemp_irq[i].isr, IRQF_SHARED | IRQF_NO_SUSPEND, ab8500_btemp_irq[i].name, di); diff --git a/drivers/power/supply/ab8500_charger.c b/drivers/power/supply/ab8500_charger.c index c053ede47eb2..ff2bb4411a22 100644 --- a/drivers/power/supply/ab8500_charger.c +++ b/drivers/power/supply/ab8500_charger.c @@ -3594,6 +3594,11 @@ static int ab8500_charger_probe(struct platform_device *pdev) /* Register interrupts */ for (i = 0; i < ARRAY_SIZE(ab8500_charger_irq); i++) { irq = platform_get_irq_byname(pdev, ab8500_charger_irq[i].name); + if (irq < 0) { + ret = irq; + goto free_irq; + } + ret = request_threaded_irq(irq, NULL, ab8500_charger_irq[i].isr, IRQF_SHARED | IRQF_NO_SUSPEND, ab8500_charger_irq[i].name, di); 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); |