Linux RTC
 help / color / mirror / Atom feed
* [PATCH] rtc: sd2405al: Fix BCD encoding of the month
@ 2026-11-24 13:41 Thorsten Blum
  2026-11-24 13:43 ` sashiko-bot
  0 siblings, 1 reply; 2+ messages in thread
From: Thorsten Blum @ 2026-11-24 13:41 UTC (permalink / raw)
  To: Tóth János, Alexandre Belloni, Bence Csókás
  Cc: Thorsten Blum, linux-rtc

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);

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-24 13:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-24 13:41 [PATCH] rtc: sd2405al: Fix BCD encoding of the month Thorsten Blum
2026-11-24 13:43 ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox