cmd: date: Handle -ENOSYS return from dm_rtc_reset()
PATCH 1/1 cmd: date: Handle -ENOSYS return from dm_rtc_reset()
In case dm_rtc_reset() returns -ENOSYS, it means the .reset callback in RTC driver is not implemented, likely because the callback is not needed. Handle the -ENOSYS return code as success and proceed, else the 'date reset' invocation incorrectly prints a bogus warning:
"## Failed to set date after RTC reset".
---
Cc: Alexander Feilke <[email protected]>
Cc: Alexander Sverdlin <[email protected]>
Cc: Markus Niebel <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: Yao Zi <[email protected]>
Cc: [email protected]
--- cmd/date.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
cmd/date.c +1 -1
@@ -44,7 +44,7 @@ static int do_date(struct cmd_tbl *cmdtp, int flag, int argc,if (strcmp (argv[1 ],"reset" ) ==0 ) {puts ("Reset RTC...\n" ); rcode =dm_rtc_reset (dev); -if (!rcode) +if (!rcode || rcode == -ENOSYS ) rcode =dm_rtc_set (dev, &default_tm);if (rcode)puts ("## Failed to set date after RTC reset\n" );
Signature · 1 line
2.53.0
Quoted 8 lines · Marek Vasut
cmd: date: Handle
-ENOSYSreturn fromdm_rtc_reset()In case
dm_rtc_reset()returns-ENOSYS, it means the .reset callback in RTC driver is not implemented, likely because the callback is not needed. Handle the-ENOSYSreturn code as success and proceed, else the 'date reset' invocation incorrectly prints a bogus warning:
"## Failed to set date after RTC reset".
Quoted 4 lines
Signed-off-by Marek Vasut <[email protected]>
cmd/date.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 8 lines · Marek Vasut
In case
dm_rtc_reset()returns-ENOSYS, it means the .reset callback in RTC driver is not implemented, likely because the callback is not needed. Handle the-ENOSYSreturn code as success and proceed, else the 'date reset' invocation incorrectly prints a bogus warning:
"## Failed to set date after RTC reset".[...]
Applied to u-boot/main, thanks!
[1/1] cmd: date: Handle -ENOSYS return from dm_rtc_reset()
commit: bc61758cbce38921310f668854bb8047f06c8c01
Signature · 1 line
Tom