mirror of
https://github.com/apache/nuttx.git
synced 2026-10-03 20:27:53 +00:00
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:
parent
144ab6f1b8
commit
b5f7b88bae
1 changed files with 8 additions and 4 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue