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

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

commit cce41d4d791c8d8eb1cfbbc5e2ff0b072768711f
Author: chao an <[email protected]>
AuthorDate: Wed Oct 28 13:42:57 2026 +0800

    drivers/timer: Avoid duplicate tick read on cancel
    
    With CONFIG_ONESHOT_COUNT, ONESHOT_TICK_CANCEL already samples the current
    tick after cancelling the lower-half timer. Do not call ONESHOT_TICK_CURRENT
    a second time from up_alarm_tick_cancel while preserving the legacy path.
    
    Signed-off-by: chao an <[email protected]>
---
 drivers/timers/arch_alarm.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/timers/arch_alarm.c b/drivers/timers/arch_alarm.c
index 270f7d221ef..58f577d6d87 100644
--- a/drivers/timers/arch_alarm.c
+++ b/drivers/timers/arch_alarm.c
@@ -372,7 +372,10 @@ int weak_function up_alarm_tick_cancel(FAR clock_t *ticks)
   if (g_oneshot_lower != NULL)
     {
       ret = ONESHOT_TICK_CANCEL(g_oneshot_lower, ticks);
+
+#ifndef CONFIG_ONESHOT_COUNT
       ONESHOT_TICK_CURRENT(g_oneshot_lower, ticks);
+#endif
     }
 
   return ret;

Reply via email to