Linux RTC
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Robert Leussler" <robert.leussler@leica-geosystems.com>
Cc: linux-rtc@vger.kernel.org,
	"Alexandre Belloni" <alexandre.belloni@bootlin.com>
Subject: Re: [PATCH] rtc: ds1307: fix RX8130 wakeup alarm WADA bit for day-of-month mode
Date: Tue, 21 Jul 2026 08:30:21 +0000	[thread overview]
Message-ID: <20260721083021.7D2921F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260721081907.3518648-1-robert.leussler@leica-geosystems.com>

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

Pre-existing issues:
- [High] Read-modify-write on the write-0-to-clear FLAG register can silently clear asynchronous hardware flags.
--

--- Patch [1]: [PATCH] rtc: ds1307: fix RX8130 wakeup alarm WADA bit for day-of-month mode ---
commit 8a134031395cee2cc4d889ef300ebcec83e18b1b
Author: Robert Leussler <robert.leussler@leica-geosystems.com>
Subject: rtc: ds1307: fix RX8130 wakeup alarm WADA bit for day-of-month mode

This commit fixes the RX8130 wakeup alarm by setting the WADA bit in the
Extension register so the day-of-month alarm works correctly, rather than
failing as an out-of-range day-of-week alarm.

> diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c
> --- a/drivers/rtc/rtc-ds1307.c
> +++ b/drivers/rtc/rtc-ds1307.c
> @@ -656,13 +656,13 @@ static int rx8130_set_alarm(struct device *dev, struct rtc_wkalrm *t)
>  
>  	/* Read control registers. */
>  	ret = regmap_bulk_read(ds1307->regmap, RX8130_REG_EXTENSION, ctl,
>  			       sizeof(ctl));
>  	if (ret < 0)
>  		return ret;
>  
> -	ctl[0] &= RX8130_REG_EXTENSION_WADA;
> +	ctl[0] |= RX8130_REG_EXTENSION_WADA;
>  	ctl[1] &= ~RX8130_REG_FLAG_AF;

[Severity: High]
This is a pre-existing issue, but could this read-modify-write sequence on 
the FLAG register (ctl[1]) silently clear asynchronous hardware flags like 
the Voltage Low Flag (VLF)?

Because the FLAG register uses write-0-to-clear semantics, any bits that
are read as 0 will be written back as 0. If a hardware flag like VLF is
asserted in the slow I2C window between regmap_bulk_read() and
regmap_bulk_write(), wouldn't writing back a 0 accidentally clear it and
potentially hide an oscillator failure from userspace?

This same read-modify-write pattern also appears to be present during
interrupt handling in rx8130_irq().

>  	ctl[2] &= ~RX8130_REG_CONTROL0_AIE;
>  
>  	ret = regmap_bulk_write(ds1307->regmap, RX8130_REG_EXTENSION, ctl,
>  				sizeof(ctl));

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260721081907.3518648-1-robert.leussler@leica-geosystems.com?part=1

      reply	other threads:[~2026-07-21  8:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-21  8:19 [PATCH] rtc: ds1307: fix RX8130 wakeup alarm WADA bit for day-of-month mode Robert Leussler
2026-07-21  8:30 ` 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=20260721083021.7D2921F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=alexandre.belloni@bootlin.com \
    --cc=linux-rtc@vger.kernel.org \
    --cc=robert.leussler@leica-geosystems.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