You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2024/09/10 15:32:46 UTC

(nuttx) 09/15: wdog: fix timer IRQ busy when timer list empty

This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit b010356b269957d93e00091eac310ce0c846f5fe
Author: ligd <li...@xiaomi.com>
AuthorDate: Mon Jul 15 23:24:39 2024 +0800

    wdog: fix timer IRQ busy when timer list empty
    
    when timer list empty, should return 0 to indicate
    we are no longer set time
    
    Signed-off-by: ligd <li...@xiaomi.com>
---
 sched/sched/sched_timerexpiration.c | 2 +-
 sched/wdog/wd_start.c               | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sched/sched/sched_timerexpiration.c b/sched/sched/sched_timerexpiration.c
index 16ea26e616..cf6fedebc8 100644
--- a/sched/sched/sched_timerexpiration.c
+++ b/sched/sched/sched_timerexpiration.c
@@ -362,7 +362,7 @@ static clock_t nxsched_timer_process(clock_t ticks, clock_t elapsed,
   tmp = nxsched_process_scheduler(ticks, elapsed, noswitches);
 
 #if CONFIG_RR_INTERVAL > 0 || defined(CONFIG_SCHED_SPORADIC)
-  if (tmp > 0 && tmp < rettime)
+  if (tmp > 0 && (rettime == 0 || tmp < rettime))
     {
       rettime = tmp;
     }
diff --git a/sched/wdog/wd_start.c b/sched/wdog/wd_start.c
index 911a86e2b7..5f9720079f 100644
--- a/sched/wdog/wd_start.c
+++ b/sched/wdog/wd_start.c
@@ -402,7 +402,7 @@ clock_t wd_timer(clock_t ticks, bool noswitches)
   if (list_is_empty(&g_wdactivelist))
     {
       leave_critical_section(flags);
-      return CLOCK_MAX;
+      return 0;
     }
 
   /* Notice that if noswitches, expired - g_wdtickbase