From: sashiko-bot@kernel.org
To: "Claudiu Beznea" <claudiu.beznea+renesas@tuxon.dev>
Cc: robh@kernel.org, "Marc Kleine-Budde" <mkl@pengutronix.de>,
"Vincent Mailhol" <mailhol@kernel.org>,
conor+dt@kernel.org, wsa+renesas@sang-engineering.com,
"Oliver Hartkopp" <socketcan@hartkopp.net>,
linux-can@vger.kernel.org, devicetree@vger.kernel.org,
"Oleksij Rempel" <o.rempel@pengutronix.de>
Subject: Re: [PATCH 6/8] can: rcar_canfd: Add support for Renesas RZ/G3S
Date: Tue, 07 Jul 2026 10:49:13 +0000 [thread overview]
Message-ID: <20260707104914.60FBD1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260707102418.1646159-7-claudiu.beznea+renesas@tuxon.dev>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] Missing enforcement of CAN-FD mode when hardware does not support classical CAN mode.
- [High] The variable `fcan_freq` is used uninitialized when clock fallback branches fail.
--
--- Patch [6]: [PATCH 6/8] can: rcar_canfd: Add support for Renesas RZ/G3S ---
commit cd9e80c9be5a9e3af3e5266e74d95204fb8cf5b3
Author: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
can: rcar_canfd: Add support for Renesas RZ/G3S
This commit adds CAN-FD support for the Renesas RZ/G3S controller. It
configures the hardware info struct to reflect the controller's capabilities,
including its lack of support for classical CAN mode and its internal clock
divider.
> diff --git a/drivers/net/can/rcar/rcar_canfd.c b/drivers/net/can/rcar/rcar_canfd.c
> index 7f01afe60a4c2..6d6b2d999b782 100644
> --- a/drivers/net/can/rcar/rcar_canfd.c
> +++ b/drivers/net/can/rcar/rcar_canfd.c
> @@ -661,6 +661,25 @@ static const struct rcar_canfd_hw_info rzg2l_hw_info = {
[ ... ]
> +static const struct rcar_canfd_hw_info r9a08g045_hw_info = {
> + .nom_bittiming = &rcar_canfd_gen4_nom_bittiming_const,
> + .data_bittiming = &rcar_canfd_gen4_data_bittiming_const,
> + .tdc_const = &rcar_canfd_gen4_tdc_const,
> + .regs = &rcar_gen4_regs,
> + .sh = &rcar_gen4_shift_data,
> + .rnc_field_width = 16,
> + .max_aflpn = 127,
> + .max_cftml = 31,
> + .max_channels = 2,
> + .postdiv = 2,
> + .multi_channel_irqs = 1,
> + .ch_interface_mode = 1,
> + .shared_can_regs = 1,
> + .external_clk = 1,
> + .fcan_pclk = 1,
> + .mode_select_na = 1,
[Severity: High]
Since this hardware sets .mode_select_na = 1 because it does not support
classical CAN mode, could there be a mismatch if the device tree contains the
"renesas,no-can-fd" property?
In rcar_canfd_probe(), we set the software mode to classical CAN if this
property is present:
drivers/net/can/rcar/rcar_canfd.c:rcar_canfd_probe() {
if (of_property_read_bool(dev->of_node, "renesas,no-can-fd"))
fdmode = false; /* Classical CAN only mode */
...
}
Since the hardware configuration bits are bypassed by .mode_select_na = 1,
would this leave the hardware in CAN-FD mode while the software driver allocates
MTU and payload sizes for classical CAN frames?
[Severity: High]
While reviewing the clock configuration related to .postdiv = 2 and
.fcan_pclk = 1, I noticed a potential regression in the clock fallback logic
that might affect older platforms.
In rcar_canfd_probe(), if "can_clk" and "canfd" clocks are missing from the
device tree, devm_clk_get_optional() returns NULL instead of an error, which
skips the error path but leaves gpriv->can_clk as NULL:
drivers/net/can/rcar/rcar_canfd.c:rcar_canfd_probe() {
...
gpriv->can_clk = devm_clk_get_optional(dev, "canfd");
if (IS_ERR(gpriv->can_clk))
return dev_err_probe(...);
if (gpriv->can_clk)
fcan_freq = clk_get_rate(gpriv->can_clk);
else if (info->fcan_pclk)
fcan_freq = clk_get_rate(gpriv->clkp);
/* CANFD clock may be further divided within the IP */
fcan_freq /= info->postdiv;
...
}
If info->fcan_pclk is 0 (which is the case for Gen3/Gen4 platforms), does
this mean fcan_freq is used uninitialized when calculating the CAN bit timing?
Can this lead to unstable or non-functional CAN buses on those platforms?
> +};
> +
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260707102418.1646159-1-claudiu.beznea+renesas@tuxon.dev?part=6
next prev parent reply other threads:[~2026-07-07 10:49 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-07 10:24 [PATCH 0/8] can: rcar_canfd: Add support for Renesas RZ/G3S Claudiu Beznea
2026-07-07 10:24 ` [PATCH 1/8] clk: r9a08g045-cpg: Add clocks and resets for CAN-FD Claudiu Beznea
2026-07-07 10:34 ` sashiko-bot
2026-07-09 15:45 ` Geert Uytterhoeven
2026-07-07 10:24 ` [PATCH 2/8] dt-bindings: can: renesas,rcar-canfd: Document RZ/G3S SoC Claudiu Beznea
2026-07-07 10:30 ` sashiko-bot
2026-07-07 16:15 ` Conor Dooley
2026-07-07 16:16 ` Conor Dooley
2026-07-07 10:24 ` [PATCH 3/8] can: rcar_canfd: Fix typos in macro names Claudiu Beznea
2026-07-07 10:24 ` [PATCH 4/8] can: rcar_canfd: Allow the CAN FD clock to be sourced from fck Claudiu Beznea
2026-07-07 10:33 ` sashiko-bot
2026-07-07 10:24 ` [PATCH 5/8] can: rcar_canfd: Do not set registers selecting the CAN mode Claudiu Beznea
2026-07-07 10:53 ` sashiko-bot
2026-07-07 10:24 ` [PATCH 6/8] can: rcar_canfd: Add support for Renesas RZ/G3S Claudiu Beznea
2026-07-07 10:49 ` sashiko-bot [this message]
2026-07-07 10:24 ` [PATCH 7/8] arm64: dts: renesas: r9a08g045: Add CAN-FD node Claudiu Beznea
2026-07-07 10:24 ` [PATCH 8/8] arm64: dts: renesas: rzg3s-smarc: Enable CAN-FD Claudiu Beznea
2026-07-07 10:31 ` [PATCH 0/8] can: rcar_canfd: Add support for Renesas RZ/G3S Biju Das
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=20260707104914.60FBD1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=claudiu.beznea+renesas@tuxon.dev \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=linux-can@vger.kernel.org \
--cc=mailhol@kernel.org \
--cc=mkl@pengutronix.de \
--cc=o.rempel@pengutronix.de \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=socketcan@hartkopp.net \
--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