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:
Xiang Xiao
2020-05-02 22:05:41 +08:00
committed by Abdelatif Guettouche
parent c8db3293bb
commit 0defe43282
20 changed files with 74 additions and 158 deletions
+6 -6
View File
@@ -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;