Messages in this thread Patch in this message | | | From | Paul Kocialkowski <> | Subject | [PATCH 2/2] rtc: hym8563: Return -EINVAL if the time is known to be invalid | Date | Thu, 12 Dec 2019 11:36:58 +0100 |
| |
The current code returns -EPERM when the voltage loss bit is set. Since the bit indicates that the time value is not valid, return -EINVAL instead, which is the appropriate error code for this situation.
Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com> --- drivers/rtc/rtc-hym8563.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/rtc/rtc-hym8563.c b/drivers/rtc/rtc-hym8563.c index 584a7815f246..e547a892b692 100644 --- a/drivers/rtc/rtc-hym8563.c +++ b/drivers/rtc/rtc-hym8563.c @@ -101,7 +101,7 @@ static int hym8563_rtc_read_time(struct device *dev, struct rtc_time *tm) if (ret & HYM8563_SEC_VL) { dev_warn(&client->dev, "no valid clock/calendar values available\n"); - return -EPERM; + return -EINVAL; } tm->tm_sec = bcd2bin(buf[0] & HYM8563_SEC_MASK); -- 2.24.0
| |