diff mbox

validation: timer: don't access non-existing timers

Message ID 1456949203-32444-1-git-send-email-zoltan.kiss@linaro.org
State Superseded
Headers show

Commit Message

Zoltan Kiss March 2, 2016, 8:06 p.m. UTC
Since e5c85d3f "validation: timer: handle early exhaustion of pool" the
workers can handle if object caches retain packets, but with enough
threads it can happen that a late starting thread won't be able to
allocate any. This for loop should take that into account and not
trying to access tt[0].ev.

Signed-off-by: Zoltan Kiss <zoltan.kiss@linaro.org>
---
 test/validation/timer/timer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox

Patch

diff --git a/test/validation/timer/timer.c b/test/validation/timer/timer.c
index 004670a..85a5061 100644
--- a/test/validation/timer/timer.c
+++ b/test/validation/timer/timer.c
@@ -338,7 +338,7 @@  static void *worker_entrypoint(void *arg TEST_UNUSED)
 	uint32_t ms;
 	uint64_t prev_tick = odp_timer_current_tick(tp);
 
-	for (ms = 0; ms < 7 * RANGE_MS / 10; ms++) {
+	for (ms = 0; ms < 7 * RANGE_MS / 10 && allocated > 0; ms++) {
 		odp_event_t ev;
 		while ((ev = odp_queue_deq(queue)) != ODP_EVENT_INVALID) {
 			/* Subtract one from prev_tick to allow for timeouts