]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
rtc: pcf8563: return -EINVAL when the voltage-low flag is set
authorDaniel Golle <daniel@makrotopia.org>
Sun, 19 Jul 2026 01:49:33 +0000 (02:49 +0100)
committerTom Rini <trini@konsulko.com>
Wed, 29 Jul 2026 20:50:18 +0000 (14:50 -0600)
Return a proper error code instead of a bare -1 (-EPERM) when VL
indicates the time is not reliable, matching rv3032 and the Linux
driver behaviour.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
drivers/rtc/pcf8563.c

index 83d60dc9b5507a92f0b97549a1283c256edb9513..b20666e8b4a8077559cb57f6b0ff61a45d7c6bef 100644 (file)
@@ -16,6 +16,7 @@
 #include <log.h>
 #include <rtc.h>
 #include <i2c.h>
+#include <linux/errno.h>
 
 #if !CONFIG_IS_ENABLED(DM_RTC)
 static uchar rtc_read  (uchar reg);
@@ -144,7 +145,7 @@ static int pcf8563_rtc_get(struct udevice *dev, struct rtc_time *tmp)
 
        if (sec & 0x80) {
                puts("### Warning: RTC Low Voltage - date/time not reliable\n");
-               rel = -1;
+               rel = -EINVAL;
        }
 
        tmp->tm_sec = bcd2bin(sec & 0x7F);