xiaoxiang781216 commented on code in PR #21001:
URL: https://github.com/apache/nuttx/pull/21001#discussion_r4380946461


##########
sched/wdog/wdog.h:
##########
@@ -127,11 +127,14 @@ uint64_t wd_timer(const hrtimer_t *timer, uint64_t 
expired);
 #ifdef CONFIG_HRTIMER
 static inline_function void wd_timer_start(clock_t tick, bool in_expiration)
 {
-  DEBUGASSERT(tick <= INT64_MAX / NSEC_PER_TICK);
   if (!in_expiration)
     {
-      hrtimer_start(&g_wdtimer, wd_timer,
-                    TICK2NSEC(tick), HRTIMER_MODE_ABS);
+      clock_t interval = clock_compare(g_wdexpired, tick) ?
+                         tick - g_wdexpired : 0u;
+      uint64_t nsec = interval <= HRTIMER_MAX_DELAY / NSEC_PER_TICK ?
+                      TICK2NSEC((uint64_t)tick) :

Review Comment:
   remove the cast



##########
sched/wdog/wd_start.c:
##########
@@ -368,7 +368,9 @@ uint64_t wd_timer(const hrtimer_t *timer, uint64_t expired)
 
   clock_t  tick = div_const(expired, NSEC_PER_TICK);
   clock_t delay = wd_expiration(tick) - tick;
-  uint64_t nsec = TICK2NSEC(delay);
-  return nsec <= HRTIMER_MAX_DELAY ? nsec : HRTIMER_MAX_DELAY;
+  uint64_t nsec = delay <= HRTIMER_MAX_DELAY / NSEC_PER_TICK ?
+                  TICK2NSEC((uint64_t)delay) : HRTIMER_MAX_DELAY;

Review Comment:
   remove the cast



##########
sched/wdog/wdog.h:
##########
@@ -131,9 +131,10 @@ static inline_function void wd_timer_start(clock_t tick, 
bool in_expiration)
     {
       clock_t interval = clock_compare(g_wdexpired, tick) ?
                          tick - g_wdexpired : 0u;
-      uint64_t nsec = interval <= HRTIMER_MAX_DELAY / NSEC_PER_TICK ?
-                      TICK2NSEC((uint64_t)tick) :
-                      TICK2NSEC(g_wdexpired) + HRTIMER_MAX_DELAY;
+      uint64_t nsec    = interval <= HRTIMER_MAX_DELAY / NSEC_PER_TICK ?
+                         TICK2NSEC((uint64_t)g_wdexpired + interval) :
+                         TICK2NSEC((uint64_t)g_wdexpired) +

Review Comment:
   remove both too



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to