From: sashiko-bot@kernel.org
To: "Cong Nguyen" <congnt264@gmail.com>
Cc: linux-rtc@vger.kernel.org,
"Alexandre Belloni" <alexandre.belloni@bootlin.com>
Subject: Re: [PATCH] rtc: ma35d1: fix unchecked IRQ error and IRQ-before-rtcdev ordering
Date: Fri, 18 Sep 2026 16:28:10 +0000 [thread overview]
Message-ID: <20260918162810.A119E1F00898@smtp.kernel.org> (raw)
In-Reply-To: <20260918161925.2639130-1-congnt264@gmail.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] rtc: devm_request_irq() called after devm_rtc_register_device()
- [Low] rtc: redundant dev_err_probe() on platform_get_irq() failure
--
commit 65db24f320f8394c839e4022831930f15fb56e95
Author: Cong Nguyen <congnt264@gmail.com>
rtc: ma35d1: fix unchecked IRQ error and IRQ-before-rtcdev ordering
This commit checks the return value of platform_get_irq() to prevent passing
a negative error code to devm_request_irq(). It also moves the IRQ
request to after the RTC device is registered, intending to fix the teardown
order.
Link: https://lore.kernel.org/r/20260914133532.CBFAA1F000FF@smtp.kernel.org
> diff --git a/drivers/rtc/rtc-ma35d1.c b/drivers/rtc/rtc-ma35d1.c
> --- a/drivers/rtc/rtc-ma35d1.c
> +++ b/drivers/rtc/rtc-ma35d1.c
> @@ -236,11 +236,8 @@ static int ma35d1_rtc_probe(struct platform_device *pdev)
> }
>
> rtc->irq_num = platform_get_irq(pdev, 0);
> -
> - ret = devm_request_irq(&pdev->dev, rtc->irq_num, ma35d1_rtc_interrupt,
> - IRQF_NO_SUSPEND, "ma35d1rtc", rtc);
> - if (ret)
> - return dev_err_probe(&pdev->dev, ret, "Failed to request rtc irq\n");
> + if (rtc->irq_num < 0)
> + return dev_err_probe(&pdev->dev, rtc->irq_num, "failed to get rtc irq\n");
[Severity: Low]
Does this cause a redundant error message to be printed? platform_get_irq()
already calls dev_err_probe() internally when it fails. Returning the error
code directly without another dev_err_probe() might be preferred.
[ ... ]
> @@ -258,6 +255,11 @@ static int ma35d1_rtc_probe(struct platform_device *pdev)
> if (ret)
> return dev_err_probe(&pdev->dev, ret, "Failed to register rtc device\n");
>
> + ret = devm_request_irq(&pdev->dev, rtc->irq_num, ma35d1_rtc_interrupt,
> + IRQF_NO_SUSPEND, "ma35d1rtc", rtc);
> + if (ret)
> + return dev_err_probe(&pdev->dev, ret, "Failed to request rtc irq\n");
> +
> return 0;
> }
[Severity: High]
Does placing devm_request_irq() after devm_rtc_register_device() introduce a
race condition?
Since devres teardown is last-in, first-out, during an unbind or a probe
failure, the IRQ would be freed before the RTC device is unregistered.
This leaves the device exposed to userspace without an active interrupt
handler, potentially leading to missed alarms or unhandled interrupt storms.
Would it be better to place devm_request_irq() between
devm_rtc_allocate_device() and devm_rtc_register_device() in
ma35d1_rtc_probe()?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260918161925.2639130-1-congnt264@gmail.com?part=1
prev parent reply other threads:[~2026-09-18 16:28 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-18 16:19 [PATCH] rtc: ma35d1: fix unchecked IRQ error and IRQ-before-rtcdev ordering Cong Nguyen
2026-09-18 16:28 ` sashiko-bot [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260918162810.A119E1F00898@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=alexandre.belloni@bootlin.com \
--cc=congnt264@gmail.com \
--cc=linux-rtc@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox