Module: xenomai-3
Branch: master
Commit: 0326d526edeb377948b68d86a51b25a403b67c81
URL:    
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=0326d526edeb377948b68d86a51b25a403b67c81

Author: Philippe Gerum <r...@xenomai.org>
Date:   Tue Jan  3 11:20:28 2017 +0100

cobalt/timer: fix spurious assertion trigger

Commit #ccbd3750c introduced a debug assertion which only makes sense
when the timer is running. Reduce the scope of this check in order to
eliminate triggers on false positive.

---

 kernel/cobalt/timer.c |   15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/kernel/cobalt/timer.c b/kernel/cobalt/timer.c
index 3a4732d..aa3bc9e 100644
--- a/kernel/cobalt/timer.c
+++ b/kernel/cobalt/timer.c
@@ -601,23 +601,21 @@ void xntimer_release_ipi(void)
 unsigned long long xntimer_get_overruns(struct xntimer *timer, xnticks_t now)
 {
        xnticks_t period = timer->interval;
-       xnsticks_t delta;
        unsigned long long overruns = 0;
+       xnsticks_t delta;
+       xntimerq_t *q;
 
-       XENO_BUG_ON(COBALT, (timer->status &
-            (XNTIMER_DEQUEUED|XNTIMER_PERIODIC)) != XNTIMER_PERIODIC);
-       
        delta = now - xntimer_pexpect(timer);
        if (unlikely(delta >= (xnsticks_t) period)) {
-               xntimerq_t *q;
-
                period = timer->interval_ns;
                delta = xnclock_ticks_to_ns(xntimer_clock(timer), delta);
                overruns = xnarch_div64(delta, period);
                timer->pexpect_ticks += overruns;
-
                if (xntimer_running_p(timer)) {
-                       q = xntimer_percpu_queue(timer);
+                       XENO_BUG_ON(COBALT, (timer->status &
+                                   (XNTIMER_DEQUEUED|XNTIMER_PERIODIC))
+                                   != XNTIMER_PERIODIC);
+                               q = xntimer_percpu_queue(timer);
                        xntimer_dequeue(timer, q);
                        while (xntimerh_date(&timer->aplink) < now) {
                                timer->periodic_ticks++;
@@ -628,6 +626,7 @@ unsigned long long xntimer_get_overruns(struct xntimer 
*timer, xnticks_t now)
        }
 
        timer->pexpect_ticks++;
+
        return overruns;
 }
 EXPORT_SYMBOL_GPL(xntimer_get_overruns);


_______________________________________________
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git

Reply via email to