otherwise "tt[i].tick" in "handle_tmo" will be a wrong value
in case timer set failed due to
ODP_TIMER_NOEVENT(failed to cancel the outstanding timer).

some hardware timer implementations needs at least two ticks gap between
"current tick" and "future tick" to cancel the outstanding active timer.

Signed-off-by: Jerin Jacob <[email protected]>
Reviewed-by: Ola Liljedahl <[email protected]>
---
v1: enclosed braces around the new "if" check as other if/else-branches use 
braces

 test/validation/odp_timer.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/test/validation/odp_timer.c b/test/validation/odp_timer.c
index 554b353..88f5208 100644
--- a/test/validation/odp_timer.c
+++ b/test/validation/odp_timer.c
@@ -365,9 +365,10 @@ static void *worker_entrypoint(void *arg TEST_UNUSED)
                        } else if (rc != ODP_TIMER_SUCCESS) {
                                /* Set/reset failed, timer already expired */
                                ntoolate++;
+                       } else if (rc == ODP_TIMER_SUCCESS) {
+                               /* Save expected expiration tick on success */
+                               tt[i].tick = cur_tick + tck;
                        }
-                       /* Save expected expiration tick */
-                       tt[i].tick = cur_tick + tck;
                }
                struct timespec ts;
                ts.tv_sec = 0;
-- 
2.1.0

_______________________________________________
lng-odp mailing list
[email protected]
https://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to