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

xiaoxiang781216 pushed a commit to branch releases/13.1
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 11b5e65114ec8e101774d2e427cdf94ea7f5dabe
Author: ouyangxiangzhen <[email protected]>
AuthorDate: Fri Jul 24 16:22:08 2026 +0800

    sched/hrtimer: Fix reprogram with wrong expiration when reinserting hrtimer
    
    In hrtimer_start_absolute, when a pending hrtimer is removed (was the
    head) and reinserted with a later expiration time, the reprogram flag
    remains true but the hrtimer is no longer the earliest timer in the
    queue. The old code passed hrtimer->expired to hrtimer_reprogram, which
    was incorrect. Use hrtimer_get_first()->expired to ensure the hardware
    timer is reprogrammed with the actual earliest timer's expiration time.
    
    Signed-off-by: ouyangxiangzhen <[email protected]>
---
 sched/hrtimer/hrtimer_start.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sched/hrtimer/hrtimer_start.c b/sched/hrtimer/hrtimer_start.c
index f994fd3ef3a..23c817abd70 100644
--- a/sched/hrtimer/hrtimer_start.c
+++ b/sched/hrtimer/hrtimer_start.c
@@ -88,7 +88,7 @@ int hrtimer_start_absolute(FAR hrtimer_t *hrtimer, 
hrtimer_entry_t func,
 
   if (reprogram)
     {
-      hrtimer_reprogram(hrtimer->expired);
+      hrtimer_reprogram(hrtimer_get_first()->expired);
     }
 
   /* Release the lock and give up the ownership of the hrtimer queue. */

Reply via email to