All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Markus Probst" <markus.probst@posteo.de>
Cc: robh@kernel.org, linux-rtc@vger.kernel.org, conor+dt@kernel.org,
	"Alexandre Belloni" <alexandre.belloni@bootlin.com>,
	devicetree@vger.kernel.org
Subject: Re: [PATCH v6 2/6] rtc: s35390a: Add missing newline to dev_err
Date: Sun, 23 Aug 2026 22:21:59 +0000	[thread overview]
Message-ID: <20260823222159.BC7671F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260824-rtc_s35390a_int1-v6-2-df96569e3412@posteo.de>

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

Pre-existing issues:
- [High] Probe clears power-on clear (POC) and battery low (BLD) flags without acting on them, causing silent data corruption.
- [High] RTC_VL_CLR ioctl performs a full hardware reset, destructively erasing the RTC time.
--

--- Patch [2]: [PATCH v6 2/6] rtc: s35390a: Add missing newline to dev_err ---
commit f317b10535ad5028ddd5cbe785ad735c87f43819
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. It fixes the log output format when disabling the alarm fails.

> 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 I noticed a potential problem
in how the probe function handles power-loss flags:

drivers/rtc/rtc-s35390a.c:s35390a_probe() {
[ ... ]
	err_read = s35390a_read_status(s35390a, &status1);
	if (err_read < 0) {
		dev_err(dev, "error resetting chip\n");
		return err_read;
	}
[ ... ]
}

Does the driver silently discard the power-loss or battery-low indicators?

When the RTC loses power, reading STATUS1 clears the hardware flags, but
s35390a_read_status() returns 1 to indicate the invalid state. Since this code
doesn't check if err_read == 1, won't it just continue and serve garbage time
data to userspace as if it were valid?

[Severity: High]
This is a pre-existing issue, but there is also a destructive behavior in the
ioctl handler:

drivers/rtc/rtc-s35390a.c:s35390a_rtc_ioctl() {
[ ... ]
	case RTC_VL_CLR:
		/* update flag and clear register */
		err = s35390a_init(s35390a);
		if (err < 0)
			return err;
		break;
[ ... ]
}

Could this ioctl destructively erase the configured RTC time?

Calling s35390a_init() writes S35390A_FLAG_RESET, which resets the chip and
erases the currently programmed time. Since RTC_VL_CLR is only meant to clear
low-voltage warnings, is it safe to let this UAPI call wipe the main time data?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260824-rtc_s35390a_int1-v6-0-df96569e3412@posteo.de?part=2

  reply	other threads:[~2026-08-23 22:22 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-23 22:13 [PATCH v6 0/6] rtc: s35390a: Allow use of output pin for interrupt signal 1 for wakealarm Markus Probst
2026-08-23 22:13 ` [PATCH v6 1/6] dt-bindings: rtc: Add pinctrl for S35390A Markus Probst
2026-08-23 22:20   ` sashiko-bot
2026-08-23 22:13 ` [PATCH v6 2/6] rtc: s35390a: Add missing newline to dev_err Markus Probst
2026-08-23 22:21   ` sashiko-bot [this message]
2026-08-25 19:25     ` Linus Walleij
2026-08-23 22:13 ` [PATCH v6 3/6] rtc: s35390a: Fix alarm not disabling Markus Probst
2026-08-23 22:19   ` sashiko-bot
2026-08-23 22:13 ` [PATCH v6 4/6] rtc: s35390a: Read 24-hour mode on access Markus Probst
2026-08-23 22:24   ` sashiko-bot
2026-08-23 22:13 ` [PATCH v6 5/6] rtc: s35390a: Add pinctrl Markus Probst
2026-08-23 22:26   ` sashiko-bot
2026-08-25 19:28     ` Linus Walleij
2026-08-25 19:36       ` Markus Probst
2026-08-26  7:31         ` Linus Walleij
2026-08-25 19:39       ` Markus Probst
2026-08-23 22:13 ` [PATCH v6 6/6] rtc: s35390a: Add synology quirk Markus Probst
2026-08-23 22:18   ` 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=20260823222159.BC7671F000E9@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 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.