Fix error in tick calculation when timer is removed
A previous changed introduced an error in the timer tick calculation
when removing a timer. This could lead to timers expiring sooner than
expected.
Bug: 17390240
Change-Id: Id3291aaf492a7178782e6f804dad71387c3c9382
diff --git a/gki/common/gki_time.c b/gki/common/gki_time.c
index b5fe7e2..aa95195 100644
--- a/gki/common/gki_time.c
+++ b/gki/common/gki_time.c
@@ -704,9 +704,6 @@
if (p_tle == NULL || p_timer_listq->p_first == NULL)
return FALSE;
- p_tle->ticks = 0;
- p_tle->in_use = FALSE;
-
/* Add the ticks remaining in this timer (if any) to the next guy in the list.
** Note: Expired timers have a tick value of '0'.
*/
@@ -715,6 +712,9 @@
p_tle->p_next->ticks += p_tle->ticks;
}
+ p_tle->ticks = 0;
+ p_tle->in_use = FALSE;
+
/* Unlink timer from the list.
*/
if (p_timer_listq->p_first == p_tle)