Linux RTC
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Sander Speetjens" <sander.speetjens@gmail.com>
Cc: "Alexandre Belloni" <alexandre.belloni@bootlin.com>,
	linux-rtc@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org,
	devicetree@vger.kernel.org
Subject: Re: [PATCH v7 2/2] rtc: Add Raspberry Pi 5 RTC driver
Date: Wed, 30 Sep 2026 08:49:05 +0000	[thread overview]
Message-ID: <20260930084905.CEA641F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260930083922.484885-3-sander.speetjens@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] dt: brittle string comparison on model property instead of compatible match
--

commit 785b9ba4b6f1ff162b94712e510b9c39d0c39474
Author: Sander Speetjens <sander.speetjens@gmail.com>

rtc: Add Raspberry Pi 5 RTC driver

Upstreaming the downstream Raspberry Pi 5 RTC driver. This driver supports
the custom DA9091, which is accessed through the firmware mailbox.

> diff --git a/drivers/firmware/raspberrypi.c b/drivers/firmware/raspberrypi.c
> index 0aa322e9a2e73..a35f00c6fb2c1 100644
> --- a/drivers/firmware/raspberrypi.c
> +++ b/drivers/firmware/raspberrypi.c
[ ... ]
> @@ -231,6 +232,27 @@ static void rpi_register_clk_driver(struct device *dev)
>  						-1, NULL, 0);
>  }
>  
> +static void rpi_register_rtc_driver(struct device *dev)
> +{
> +	struct device_node *firmware;
> +
> +	// Check if our model is a Raspberry Pi 5, as the RTC is only present on that model.
> +	const char *model = of_get_property(of_root, "model", NULL);
> +
> +	if (!model || strncmp(model, "Raspberry Pi 5", 14) != 0)

[Severity: Medium]
Is it safe to use strncmp() on the human-readable "model" property to
identify the board here in rpi_register_rtc_driver()?

Since the check only compares the first 14 characters, could this incorrectly
match unrecognized future devices like 'Raspberry Pi 500' and improperly
register the RTC?

Would it be better to use of_machine_is_compatible() with a compatible string
match instead, which is more robust against formatting changes?

> +		return;
> +
> +	firmware = of_get_compatible_child(dev->of_node,
> +					   "raspberrypi,firmware-rtc");

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260930083922.484885-1-sander.speetjens@gmail.com?part=2

  reply	other threads:[~2026-09-30  8:49 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-30  8:39 [PATCH v7 0/2] Raspberry Pi 5 RTC driver Sander Speetjens
2026-09-30  8:39 ` [PATCH v7 1/2] dt-bindings: rtc: Add property for Raspberry Pi 5 RTC Sander Speetjens
2026-09-30  8:44   ` sashiko-bot
2026-09-30  8:39 ` [PATCH v7 2/2] rtc: Add Raspberry Pi 5 RTC driver Sander Speetjens
2026-09-30  8:49   ` sashiko-bot [this message]
2026-09-30  9:28   ` Alexandre Belloni

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=20260930084905.CEA641F00893@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=robh@kernel.org \
    --cc=sander.speetjens@gmail.com \
    --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