mirror of
https://github.com/apache/nuttx.git
synced 2026-05-31 14:27:37 +08:00
OS internal function should indicate the error by return negative value
instead to change errno value by calling set_errno Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
committed by
Abdelatif Guettouche
parent
c8db3293bb
commit
0defe43282
@@ -223,7 +223,7 @@ static int ez80_rdtime(FAR struct rtc_lowerhalf_s *lower,
|
||||
ret = up_rtc_gettime(&ts);
|
||||
if (ret < 0)
|
||||
{
|
||||
goto errout_with_errno;
|
||||
goto errout;
|
||||
}
|
||||
|
||||
/* Convert the one second epoch time to a struct tm. This operation
|
||||
@@ -233,15 +233,15 @@ static int ez80_rdtime(FAR struct rtc_lowerhalf_s *lower,
|
||||
|
||||
if (!gmtime_r(&ts.tv_sec, (FAR struct tm *)rtctime))
|
||||
{
|
||||
goto errout_with_errno;
|
||||
ret = -get_errno();
|
||||
goto errout;
|
||||
}
|
||||
|
||||
return OK;
|
||||
|
||||
errout_with_errno:
|
||||
ret = get_errno();
|
||||
DEBUGASSERT(ret > 0);
|
||||
return -ret;
|
||||
errout:
|
||||
DEBUGASSERT(ret < 0);
|
||||
return ret;
|
||||
|
||||
#else
|
||||
time_t timer;
|
||||
|
||||
Reference in New Issue
Block a user