sched/clock: Normalize CLOCK_FD getres errors.

Convert failures from CLOCK_FD lookup and PTP_CLOCK_GETRES into the public
clock_getres() convention of returning ERROR and setting errno. This keeps
dynamic PTP clocks consistent with the other clock_getres() error paths.

Assisted-by: OpenAI Codex
Signed-off-by: yushuailong <yyyusl@qq.com>
This commit is contained in:
yushuailong 2026-09-12 15:40:05 +08:00 • committed by Xiang Xiao
parent 144ab6f1b8
commit b5f7b88bae

View file

@ -81,13 +81,17 @@ int clock_getres(clockid_t clock_id, struct timespec *res)
FAR struct file *filep;
ret = ptp_clockid_to_filep(clock_id, &filep);
if (ret < 0)
if (ret >= 0)
{
return ret;
ret = file_ioctl(filep, PTP_CLOCK_GETRES, res);
file_put(filep);
}
ret = file_ioctl(filep, PTP_CLOCK_GETRES, res);
file_put(filep);
if (ret < 0)
{
set_errno(-ret);
ret = ERROR;
}
}
break;
#endif