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

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

commit 78dce81c5a4b1433c65ec3e4599a6670be3ebce5
Author: ouyangxiangzhen <[email protected]>
AuthorDate: Mon Jan 26 16:53:53 2026 +0800

    sched/hrtimer: Fix uncancelled hardware timer.
    
    If there are no timers in the hrtimer queue, we should cancel the timers to 
avoid unnecessary timer interruptions. Since we currently do not have a timer 
cancellation interface, we can achieve cancellation by setting the timer to its 
maximum value.
    
    Signed-off-by: ouyangxiangzhen <[email protected]>
---
 sched/hrtimer/hrtimer_cancel.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/sched/hrtimer/hrtimer_cancel.c b/sched/hrtimer/hrtimer_cancel.c
index 930221fb2f7..83c5ccbee97 100644
--- a/sched/hrtimer/hrtimer_cancel.c
+++ b/sched/hrtimer/hrtimer_cancel.c
@@ -97,11 +97,11 @@ int hrtimer_cancel(FAR hrtimer_t *hrtimer)
 
       if (hrtimer_remove(hrtimer))
         {
+          uint64_t next_expired;
+
           first = hrtimer_get_first();
-          if (first != NULL)
-            {
-              hrtimer_reprogram(first->expired);
-            }
+          next_expired = first != NULL ? first->expired : UINT64_MAX;
+          hrtimer_reprogram(next_expired);
         }
     }
 

Reply via email to