diff mbox

linux-generic: timer: set timer queue to ODP_QUEUE_INVALID on init

Message ID 1435140792-25439-1-git-send-email-ivan.khoronzhuk@linaro.org
State Superseded
Headers show

Commit Message

Ivan Khoronzhuk June 24, 2015, 10:13 a.m. UTC
The set_next_free() checks if timer queue is not set, that is
ODP_QUEUE_INVALID. In case of linux-generic the invalid queue is 0.
By coincidence, after allocation, the timer queue is also 0, by this
way the ODP_ASSERT is masked. In case ODP_QUEUE_INVALID is another
from 0 the test generates error. It's not correct, the code shouldn't
have such kind dependency from macro definition, and it prevents to
re-use this code for another platforms with different
ODP_QUEUE_INVALID. So, fix it.

Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
---
 platform/linux-generic/odp_timer.c | 1 +
 1 file changed, 1 insertion(+)
diff mbox

Patch

diff --git a/platform/linux-generic/odp_timer.c b/platform/linux-generic/odp_timer.c
index 0d0f48b..68d7b11 100644
--- a/platform/linux-generic/odp_timer.c
+++ b/platform/linux-generic/odp_timer.c
@@ -244,6 +244,7 @@  static odp_timer_pool *odp_timer_pool_new(
 	/* Initialize all odp_timer entries */
 	uint32_t i;
 	for (i = 0; i < tp->param.num_timers; i++) {
+		tp->timers[i].queue = ODP_QUEUE_INVALID;
 		set_next_free(&tp->timers[i], i + 1);
 		tp->timers[i].user_ptr = NULL;
 		odp_atomic_init_u64(&tp->tick_buf[i].exp_tck, TMO_UNUSED);