mirror of
https://github.com/apache/nuttx.git
synced 2026-10-03 04:07:55 +00:00
sched/wdog: Reject zero delay in wd_start_next.
wd_start_next() schedules relative to the previous expiration. A zero value reuses that expiration, so a callback can immediately reinsert an already expired watchdog and make wd_expiration() loop without advancing time. Reject non-positive delays to guarantee that the next expiration advances. Assisted-by: OpenAI Codex <noreply@openai.com> Signed-off-by: yushuailong <yyyusl@qq.com>
This commit is contained in:
parent
bfb2cd5541
commit
e5d9960f56
1 changed files with 2 additions and 2 deletions
|
|
@ -309,7 +309,7 @@ int wd_start_realtime(FAR struct wdog_s *wdog,
|
|||
*
|
||||
* Input Parameters:
|
||||
* wdog - Pointer of the periodic watchdog.
|
||||
* delay - Delayed time in system ticks.
|
||||
* delay - Positive delay in system ticks.
|
||||
* wdentry - Function to call on timeout.
|
||||
* arg - Parameter to pass to wdentry.
|
||||
*
|
||||
|
|
@ -331,7 +331,7 @@ int wd_start_next(FAR struct wdog_s *wdog, clock_t delay,
|
|||
{
|
||||
/* Ensure delay is within the range the wdog can handle. */
|
||||
|
||||
if (delay < 0 || delay > WDOG_MAX_DELAY)
|
||||
if (delay <= 0 || delay > WDOG_MAX_DELAY)
|
||||
{
|
||||
return -EINVAL;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue