From: sashiko-bot@kernel.org
To: Prabhakar <prabhakar.csengg@gmail.com>
Cc: linux-rtc@vger.kernel.org, wsa+renesas@sang-engineering.com,
robh@kernel.org,
"Alexandre Belloni" <alexandre.belloni@bootlin.com>,
devicetree@vger.kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v3 12/12] rtc: rzn1: Add support for Renesas RZ/T2H and RZ/N2H SoCs
Date: Mon, 06 Jul 2026 18:03:30 +0000 [thread overview]
Message-ID: <20260706180331.3AD811F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260706175138.12587-13-prabhakar.mahadev-lad.rj@bp.renesas.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] The driver may incorrectly fall back to SUBU mode on RZ/T2H and RZ/N2H SoCs, leading to accesses of the non-existent RTCA0SUBU register and a potential kernel panic.
--
commit ee14aa230b364e5ad7677d78cb0c0a8599351c1c
Author: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
rtc: rzn1: Add support for Renesas RZ/T2H and RZ/N2H SoCs
This commit adds support for the RTC block on Renesas RZ/T2H and RZ/N2H SoCs
using a new compatible string. It notes that the variants lack the RTCA0SUBU
register, but rely on the existing SCMP mode to function without it.
> diff --git a/drivers/rtc/rtc-rzn1.c b/drivers/rtc/rtc-rzn1.c
> index d1a974c6b8bbe..1d4d8d01749d3 100644
> --- a/drivers/rtc/rtc-rzn1.c
> +++ b/drivers/rtc/rtc-rzn1.c
> @@ -508,6 +508,7 @@ static int rzn1_rtc_probe(struct platform_device *pdev)
> }
>
> static const struct of_device_id rzn1_rtc_of_match[] = {
> + { .compatible = "renesas,r9a09g077-rtc" },
[Severity: High]
If the devicetree for this SoC omits the "xtal" clock or specifies a standard
32768 Hz frequency, will the driver inadvertently fall back to SUBU mode?
Looking at rzn1_rtc_probe(), the driver sets scmp_val = 0 for 32768 Hz
crystals or when the clock is absent:
drivers/rtc/rtc-rzn1.c:rzn1_rtc_probe() {
...
xtal = devm_clk_get_optional(dev, "xtal");
if (IS_ERR(xtal)) {
return PTR_ERR(xtal);
} else if (xtal) {
rate = clk_get_rate(xtal);
...
if (rate != 32768)
scmp_val = RZN1_RTC_CTL0_SLSB_SCMP;
}
...
if (scmp_val) {
...
} else {
rtc->rtcdev->ops = &rzn1_rtc_ops_subu;
}
...
}
If this happens on the RZ/T2H, rzn1_rtc_ops_subu exposes the .read_offset
and .set_offset callbacks. Any userspace read of the offset sysfs node
would then trigger a hardware access to the missing register:
drivers/rtc/rtc-rzn1.c:rzn1_rtc_read_offset() {
...
val = readl(rtc->base + RZN1_RTC_SUBU);
...
}
Can this lead to a synchronous external abort (kernel panic) when an
unprivileged user reads /sys/class/rtc/rtc0/offset?
Should we add match data to this compatible string to identify the variant
and explicitly reject probe with -EOPNOTSUPP if the clock configuration
would require the unsupported SUBU mode?
> { .compatible = "renesas,rzn1-rtc" },
> {},
> };
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260706175138.12587-1-prabhakar.mahadev-lad.rj@bp.renesas.com?part=12
prev parent reply other threads:[~2026-07-06 18:03 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-06 17:51 [PATCH v3 00/12] Add RTC support for Renesas RZ/T2H and RZ/N2H SoCs Prabhakar
2026-07-06 17:51 ` [PATCH v3 01/12] dt-bindings: rtc: renesas,rzn1-rtc: Add RZ/T2H and RZ/N2H support Prabhakar
2026-07-06 17:58 ` sashiko-bot
2026-07-06 17:51 ` [PATCH v3 02/12] rtc: rzn1: Handle EPROBE_DEFER for optional pps interrupt Prabhakar
2026-07-06 17:56 ` sashiko-bot
2026-07-06 17:51 ` [PATCH v3 03/12] rtc: rzn1: fix weekday underflow when alarm crosses month boundary Prabhakar
2026-07-06 18:00 ` sashiko-bot
2026-07-06 17:51 ` [PATCH v3 04/12] rtc: rzn1: Fix malformed MODULE_AUTHOR string Prabhakar
2026-07-06 17:53 ` sashiko-bot
2026-07-06 17:51 ` [PATCH v3 05/12] rtc: Kconfig: Broaden RTC_DRV_RZN1 dependency to ARCH_RENESAS Prabhakar
2026-07-06 17:54 ` sashiko-bot
2026-07-06 17:51 ` [PATCH v3 06/12] rtc: rzn1: Fix alarm range check truncation on 32-bit systems Prabhakar
2026-07-06 18:04 ` sashiko-bot
2026-07-06 17:51 ` [PATCH v3 07/12] rtc: rzn1: Replace remove callback with devm_add_action_or_reset() Prabhakar
2026-07-06 17:58 ` sashiko-bot
2026-07-06 17:51 ` [PATCH v3 08/12] rtc: rzn1: Dynamically calculate synchronization delay based on clock rate Prabhakar
2026-07-06 17:58 ` sashiko-bot
2026-07-06 17:51 ` [PATCH v3 09/12] rtc: rzn1: Use temporary variable for struct device Prabhakar
2026-07-06 17:56 ` sashiko-bot
2026-07-06 17:51 ` [PATCH v3 10/12] rtc: rzn1: Consistently use dev_err_probe() Prabhakar
2026-07-06 17:55 ` sashiko-bot
2026-07-06 17:51 ` [PATCH v3 11/12] rtc: rzn1: use FIELD_PREP/FIELD_GET and GENMASK for register access Prabhakar
2026-07-06 17:57 ` sashiko-bot
2026-07-06 17:51 ` [PATCH v3 12/12] rtc: rzn1: Add support for Renesas RZ/T2H and RZ/N2H SoCs Prabhakar
2026-07-06 18:03 ` 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=20260706180331.3AD811F000E9@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.