rtc: da9063: 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>
Tested-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
Link: https://lore.kernel.org/r/20191004150510.6278-1-krzk@kernel.org
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
This commit is contained in:
Krzysztof Kozlowski 2019-10-04 17:05:10 +02:00 committed by Alexandre Belloni
parent cf79e7c3c9
commit 7da83f1bba
1 changed files with 3 additions and 0 deletions

View File

@ -483,6 +483,9 @@ static int da9063_rtc_probe(struct platform_device *pdev)
rtc->rtc_dev->uie_unsupported = 1; rtc->rtc_dev->uie_unsupported = 1;
irq_alarm = platform_get_irq_byname(pdev, "ALARM"); irq_alarm = platform_get_irq_byname(pdev, "ALARM");
if (irq_alarm < 0)
return irq_alarm;
ret = devm_request_threaded_irq(&pdev->dev, irq_alarm, NULL, ret = devm_request_threaded_irq(&pdev->dev, irq_alarm, NULL,
da9063_alarm_event, da9063_alarm_event,
IRQF_TRIGGER_LOW | IRQF_ONESHOT, IRQF_TRIGGER_LOW | IRQF_ONESHOT,