rtc: as3722: check return value of platform_get_irq()
Subsystems (2)
PATCH 1/1 rtc: as3722: check return value of platform_get_irq()
In as3722_rtc_probe(), the return value of platform_get_irq() is assigned to as3722_rtc->alarm_irq without error checking.
If platform_get_irq() fails (such as returning -EPROBE_DEFER when the parent interrupt controller is not yet ready), the driver logs an invalid IRQ number in dev_info() and calls devm_request_threaded_irq() with a negative value. This causes devm_request_threaded_irq() to fail with -EINVAL and abort probe permanently, breaking deferred probing.
Check the return value of platform_get_irq() and return immediately on failure to properly propagate errors.
--- drivers/rtc/rtc-as3722.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/rtc/rtc-as3722.c +3 -0
@@ -198,6 +198,9 @@ static int as3722_rtc_probe(struct platform_device *pdev) } as3722_rtc->alarm_irq =platform_get_irq (pdev,0 ); +if (as3722_rtc->alarm_irq <0 ) +return as3722_rtc->alarm_irq; +dev_info (&pdev->dev,"RTC interrupt %d\n" , as3722_rtc->alarm_irq); ret = devm_request_threaded_irq(&pdev->dev, as3722_rtc->alarm_irq, NULL,
Signature · 1 line
2.56.0.windows.4
[email protected]
AI reviewSashiko has reviewed this patch and found no issues.
Quoted 9 lines
In
as3722_rtc_probe(), the return value ofplatform_get_irq()is assigned toas3722_rtc->alarm_irqwithout error checking.If
platform_get_irq()fails (such as returning -EPROBE_DEFER when the parent interrupt controller is not yet ready), the driver logs an invalid IRQ number indev_info()and callsdevm_request_threaded_irq()with a negative value. This causesdevm_request_threaded_irq()to fail with-EINVALand abort probe permanently, breaking deferred probing.
Quoted 6 lines
Check the return value of
platform_get_irq()and return immediately on failure to properly propagate errors.Fixes b45062619840 ("drivers/rtc/rtc-as3722: add RTC driver")Signed-off-by Akshat Rawat <[email protected]>
Sashiko has reviewed this patch and found no issues.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1