From: sashiko-bot@kernel.org
To: Prabhakar <prabhakar.csengg@gmail.com>
Cc: wsa+renesas@sang-engineering.com, linux-rtc@vger.kernel.org,
devicetree@vger.kernel.org, conor+dt@kernel.org, robh@kernel.org,
"Alexandre Belloni" <alexandre.belloni@bootlin.com>
Subject: Re: [PATCH v2 08/10] rtc: rzn1: Consistently use dev_err_probe()
Date: Wed, 01 Jul 2026 14:50:53 +0000 [thread overview]
Message-ID: <20260701145053.757001F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260701142953.2014895-9-prabhakar.mahadev-lad.rj@bp.renesas.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Premature pm_runtime_put() in remove callback leads to a potential bus fault or kernel panic due to devres teardown ordering.
--
commit 20388d9c3bb9eb8111711742d828f2997e736384
Author: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
rtc: rzn1: Consistently use dev_err_probe()
This patch updates rzn1_rtc_probe() to use dev_err_probe() when the alarm
interrupt request fails. This brings the error handling into alignment with
the rest of the probe function.
> diff --git a/drivers/rtc/rtc-rzn1.c b/drivers/rtc/rtc-rzn1.c
> index 244d0fc70fdad..d990075839c13 100644
> --- a/drivers/rtc/rtc-rzn1.c
> +++ b/drivers/rtc/rtc-rzn1.c
> @@ -471,7 +471,7 @@ static int rzn1_rtc_probe(struct platform_device *pdev)
>
> ret = devm_request_irq(dev, irq, rzn1_rtc_alarm_irq, 0, "RZN1 RTC Alarm", rtc);
> if (ret) {
> - dev_err(dev, "RTC alarm interrupt not available\n");
> + dev_err_probe(dev, ret, "RTC alarm interrupt not available\n");
> goto dis_runtime_pm;
> }
[Severity: High]
This isn't a bug introduced by this patch, but since we are looking at driver
error handling and teardown paths, is there a potential use-after-suspend
issue during device removal?
Since the RTC is registered using devm_rtc_register_device() in
rzn1_rtc_probe(), it remains registered and accessible to user space until
the devres teardown runs, which happens after rzn1_rtc_remove() returns.
However, rzn1_rtc_remove() manually drops the runtime PM reference:
drivers/rtc/rtc-rzn1.c:rzn1_rtc_remove() {
...
/* Disable all interrupts */
writel(0, rtc->base + RZN1_RTC_CTL1);
pm_runtime_put(&pdev->dev);
}
If a user-space process accesses the RTC device (like reading the time via
ioctl) precisely during driver unbinding after pm_runtime_put() is called,
would this access hardware registers while the clock is gated and trigger
a kernel panic?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260701142953.2014895-1-prabhakar.mahadev-lad.rj@bp.renesas.com?part=8
next prev parent reply other threads:[~2026-07-01 14:50 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-01 14:29 [PATCH v2 00/10] Add RTC support for Renesas RZ/T2H and RZ/N2H SoCs Prabhakar
2026-07-01 14:29 ` [PATCH v2 01/10] dt-bindings: rtc: renesas,rzn1-rtc: Add RZ/T2H and RZ/N2H support Prabhakar
2026-07-01 14:35 ` sashiko-bot
2026-07-01 14:29 ` [PATCH v2 02/10] rtc: rzn1: Handle EPROBE_DEFER for optional pps interrupt Prabhakar
2026-07-01 14:39 ` sashiko-bot
2026-07-01 14:29 ` [PATCH v2 03/10] rtc: rzn1: Fix malformed MODULE_AUTHOR string Prabhakar
2026-07-01 14:32 ` sashiko-bot
2026-07-01 14:29 ` [PATCH v2 04/10] rtc: Kconfig: Broaden RTC_DRV_RZN1 dependency to ARCH_RENESAS Prabhakar
2026-07-01 14:39 ` sashiko-bot
2026-07-01 14:29 ` [PATCH v2 05/10] rtc: rzn1: Fix alarm range check truncation on 32-bit systems Prabhakar
2026-07-01 14:45 ` sashiko-bot
2026-07-01 14:29 ` [PATCH v2 06/10] rtc: rzn1: Dynamically calculate synchronization delay based on clock rate Prabhakar
2026-07-01 14:49 ` sashiko-bot
2026-07-01 14:29 ` [PATCH v2 07/10] rtc: rzn1: Use temporary variable for struct device Prabhakar
2026-07-01 14:43 ` sashiko-bot
2026-07-01 14:29 ` [PATCH v2 08/10] rtc: rzn1: Consistently use dev_err_probe() Prabhakar
2026-07-01 14:50 ` sashiko-bot [this message]
2026-07-01 14:29 ` [PATCH v2 09/10] rtc: rzn1: use FIELD_PREP/FIELD_GET and GENMASK for register access Prabhakar
2026-07-01 14:48 ` sashiko-bot
2026-07-01 14:29 ` [PATCH v2 10/10] rtc: rzn1: Add support for Renesas RZ/T2H and RZ/N2H SoCs Prabhakar
2026-07-01 14:54 ` sashiko-bot
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=20260701145053.757001F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=alexandre.belloni@bootlin.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=linux-rtc@vger.kernel.org \
--cc=prabhakar.csengg@gmail.com \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=wsa+renesas@sang-engineering.com \
/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