From: Thorsten Blum <blum@kernel.org>
To: "Tóth János" <gomba007@gmail.com>,
"Alexandre Belloni" <alexandre.belloni@bootlin.com>,
"Bence Csókás" <bence98@sch.bme.hu>
Cc: Thorsten Blum <blum@kernel.org>, linux-rtc@vger.kernel.org
Subject: [PATCH] rtc: sd2405al: Fix BCD encoding of the month
Date: Tue, 24 Nov 2026 14:41:11 +0100 [thread overview]
Message-ID: <20261124134110.237481-2-blum@kernel.org> (raw)
The SD2405AL expects a one-based month encoded as BCD, while tm_mon is
zero-based. Adding 1 after converting tm_mon to BCD incorrectly encodes
October as 0x0a instead of 0x10.
Add 1 to tm_mon before converting it to BCD.
Fixes: 5af858acea22 ("rtc: Add driver for SD2405AL")
Signed-off-by: Thorsten Blum <blum@kernel.org>
---
drivers/rtc/rtc-sd2405al.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/rtc/rtc-sd2405al.c b/drivers/rtc/rtc-sd2405al.c
index 990080f09457..5f023e3abac8 100644
--- a/drivers/rtc/rtc-sd2405al.c
+++ b/drivers/rtc/rtc-sd2405al.c
@@ -129,7 +129,7 @@ static int sd2405al_set_time(struct device *dev, struct rtc_time *time)
data[SD2405AL_REG_T_HOUR] = bin2bcd(time->tm_hour) | SD2405AL_BIT_24H;
data[SD2405AL_REG_T_DAY] = bin2bcd(time->tm_mday);
data[SD2405AL_REG_T_WEEK] = bin2bcd(time->tm_wday);
- data[SD2405AL_REG_T_MON] = bin2bcd(time->tm_mon) + 1;
+ data[SD2405AL_REG_T_MON] = bin2bcd(time->tm_mon + 1);
data[SD2405AL_REG_T_YEAR] = bin2bcd(time->tm_year - 100);
ret = sd2405al_enable_reg_write(sd2405al);
next reply other threads:[~2026-11-24 13:42 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-24 13:41 Thorsten Blum [this message]
2026-11-24 13:43 ` [PATCH] rtc: sd2405al: Fix BCD encoding of the month sashiko-bot
2026-11-25 12:21 ` Tóth János
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=20261124134110.237481-2-blum@kernel.org \
--to=blum@kernel.org \
--cc=alexandre.belloni@bootlin.com \
--cc=bence98@sch.bme.hu \
--cc=gomba007@gmail.com \
--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 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.