summaryrefslogtreecommitdiff
path: root/drivers/power/supply/ab8500_charger.c
diff options
context:
space:
mode:
authorKrzysztof Kozlowski <krzk@kernel.org>2019-10-04 17:07:38 +0200
committerSebastian Reichel <sre@kernel.org>2019-10-20 15:18:44 +0200
commitb10e97003d28f6c83edd79e17dfec91acfbb7377 (patch)
tree94c8d7ada292b18dd8def67c664c488636aebd55 /drivers/power/supply/ab8500_charger.c
parent24108993278d67174a61f9ead38d4d9d1c001a14 (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/supply/ab8500_charger.c')
-rw-r--r--drivers/power/supply/ab8500_charger.c5
1 files changed, 5 insertions, 0 deletions
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);