public inbox for linux-rtc@vger.kernel.org
 help / color / mirror / Atom feed
From: Andreas Gabriel-Platschek <andi.platschek@gmail.com>
To: alexandre.belloni@bootlin.com
Cc: linux-rtc@vger.kernel.org, linux-kernel@vger.kernel.org,
	Andreas Gabriel-Platschek <andi.platschek@gmail.com>
Subject: [PATCH] rtc: ds1390: fix number of bytes read from RTC
Date: Mon,  9 Feb 2026 06:34:39 +0100	[thread overview]
Message-ID: <20260209053439.313825-1-andi.platschek@gmail.com> (raw)

The spi_write_then_read() reads 8 bytes starting from
DS1390_REG_SECONDS (== 0x01), so the last byte read would already
be part of the alarm (Tenths and Hundredths of Seconds) feature.

However 7 bytes are engouh -- seconds (0x01), minutes (0x02), hours (0x03),
day (0x04), date (0x05), month/century (0x06) and year (0x07).

Signed-off-by: Andreas Gabriel-Platschek <andi.platschek@gmail.com>
---
 drivers/rtc/rtc-ds1390.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-ds1390.c b/drivers/rtc/rtc-ds1390.c
index f46428ca77cc..f7afd6bdeb4a 100644
--- a/drivers/rtc/rtc-ds1390.c
+++ b/drivers/rtc/rtc-ds1390.c
@@ -134,7 +134,7 @@ static int ds1390_read_time(struct device *dev, struct rtc_time *dt)
 	chip->txrx_buf[0] = DS1390_REG_SECONDS;
 
 	/* do the i/o */
-	status = spi_write_then_read(spi, chip->txrx_buf, 1, chip->txrx_buf, 8);
+	status = spi_write_then_read(spi, chip->txrx_buf, 1, chip->txrx_buf, 7);
 	if (status != 0)
 		return status;
 
-- 
2.47.3


                 reply	other threads:[~2026-02-09  5:35 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20260209053439.313825-1-andi.platschek@gmail.com \
    --to=andi.platschek@gmail.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rtc@vger.kernel.org \
    /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