Skip to contentSkip to conversation

rtc: sandbox: initialize all rtc_time fields

PATCH New Vincent Stehlé 1 participant 1 message Nov 19 Real time clock (RTC)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rtc: sandbox: initialize all rtc_time fields

The get() method of rtc drivers must initialize all the fields of the rtc_time structure, but the sandbox_rtc_get() function does not initialize the tm_yday and tm_isdst fields.
Initialize them to zero to fix this, as many other rtc drivers do.

This can be verified on the sandbox with CONFIG_VALGRIND=y and the following command:

valgrind --suppressions=scripts/u-boot.supp \
./u-boot -T -c 'setenv efi_selftest real time clock; bootefi selftest'

---
 drivers/rtc/sandbox_rtc.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/rtc/sandbox_rtc.c +2 -0
index 1ade5d50b23..dfbfdd2763c 100644
@@ -28,6 +28,8 @@ static int sandbox_rtc_get(struct udevice *dev, struct rtc_time *time)
 	time->tm_mon  = buf[REG_MON - REG_SEC];
 	time->tm_year = buf[REG_YEAR - REG_SEC] + 1900;
 	time->tm_wday = buf[REG_WDAY - REG_SEC];
+	time->tm_yday = 0;
+	time->tm_isdst = 0;
 
 	return 0;
 }

---
base-commit: f6e8f09ed39347359ebddd983b96993c78b4ec7d
change-id: 20261119-isdst-536be628c635

Best regards,

Signature · 1 line
Vincent.