Linux RTC
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Markus Probst" <markus.probst@posteo.de>
Cc: devicetree@vger.kernel.org, robh@kernel.org,
	linux-rtc@vger.kernel.org, conor+dt@kernel.org,
	"Alexandre Belloni" <alexandre.belloni@bootlin.com>
Subject: Re: [PATCH v7 2/6] rtc: s35390a: Add missing newline to dev_err
Date: Sat, 29 Aug 2026 14:32:16 +0000	[thread overview]
Message-ID: <20260829143217.55DC11F00A3D@smtp.kernel.org> (raw)
In-Reply-To: <20260829-rtc_s35390a_int1-v7-2-debcd31143ae@posteo.de>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] RTC_VL_READ ioctl clears low-voltage hardware flags without caching them, silently masking time corruption for subsequent reads.
--

commit d2afec77b76a14e1c30b1da14673de2795a5f488
Author: Markus Probst <markus.probst@posteo.de>

rtc: s35390a: Add missing newline to dev_err

This commit adds a missing newline character to a dev_err() message
in the probe function of the s35390a RTC driver.

> diff --git a/drivers/rtc/rtc-s35390a.c b/drivers/rtc/rtc-s35390a.c
> index b72eef4fb0997..4cfe7034c5165 100644
> --- a/drivers/rtc/rtc-s35390a.c
> +++ b/drivers/rtc/rtc-s35390a.c
> @@ -494,7 +494,7 @@ static int s35390a_probe(struct i2c_client *client)
>  		buf = 0;
>  		err = s35390a_set_reg(s35390a, S35390A_CMD_STATUS2, &buf, 1);
>  		if (err < 0) {
> -			dev_err(dev, "error disabling alarm");
> +			dev_err(dev, "error disabling alarm\n");
>  			return err;
>  		}
>  	} else {

[Severity: High]
This isn't a bug introduced by this patch, but while reviewing this file,
I noticed a potential issue with how power-loss events are handled.

Does the RTC_VL_READ ioctl clear the low-voltage hardware flags without caching
them?

Looking at s35390a_rtc_ioctl() in drivers/rtc/rtc-s35390a.c:

	case RTC_VL_READ:
		/* s35390a_reset set lowvoltage flag and init RTC if needed */
		err = s35390a_read_status(s35390a, &sts);
		if (err < 0)
			return err;
		if (copy_to_user((void __user *)arg, &err, sizeof(int)))

It appears s35390a_read_status() reads the hardware status register, which 
automatically clears the low voltage flags in the hardware upon reading.

Because the driver does not cache this state or reinitialize the chip to a known
state, the hardware permanently forgets that a power loss occurred.

Will a subsequent call to read the time via s35390a_rtc_read_time() read
the status register, receive no error, and silently return corrupted or 
uninitialized time data to userspace instead of returning an error?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260829-rtc_s35390a_int1-v7-0-debcd31143ae@posteo.de?part=2

  reply	other threads:[~2026-08-29 14:32 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-29 14:22 [PATCH v7 0/6] rtc: s35390a: Allow use of output pin for interrupt signal 1 for wakealarm Markus Probst
2026-08-29 14:22 ` [PATCH v7 1/6] dt-bindings: rtc: Add pinctrl for S35390A Markus Probst
2026-08-29 14:32   ` sashiko-bot
2026-08-31 16:47   ` Conor Dooley
2026-08-29 14:22 ` [PATCH v7 3/6] rtc: s35390a: Fix alarm not disabling Markus Probst
2026-08-29 14:31   ` sashiko-bot
2026-08-29 14:22 ` [PATCH v7 2/6] rtc: s35390a: Add missing newline to dev_err Markus Probst
2026-08-29 14:32   ` sashiko-bot [this message]
2026-08-29 14:22 ` [PATCH v7 4/6] rtc: s35390a: Read 24-hour mode on access Markus Probst
2026-08-29 14:37   ` sashiko-bot
2026-08-29 14:22 ` [PATCH v7 5/6] rtc: s35390a: Add pinctrl Markus Probst
2026-08-29 14:32   ` sashiko-bot
2026-08-29 14:22 ` [PATCH v7 6/6] rtc: s35390a: Add synology quirk Markus Probst
2026-08-29 14:30   ` 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=20260829143217.55DC11F00A3D@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=markus.probst@posteo.de \
    --cc=robh@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