cpu_base->nr_events++;
        dev->next_event.tv64 = KTIME_MAX;
 
+       raw_spin_lock(&cpu_base->lock);
        entry_time = now = ktime_get();
 retry:
        expires_next.tv64 = KTIME_MAX;
-
-       raw_spin_lock(&cpu_base->lock);
        /*
         * We set expires_next to KTIME_MAX here with cpu_base->lock
         * held to prevent that a timer is enqueued in our queue via
         * interrupt routine. We give it 3 attempts to avoid
         * overreacting on some spurious event.
         */
+       raw_spin_lock(&cpu_base->lock);
        now = ktime_get();
        cpu_base->nr_retries++;
        if (++retries < 3)
         */
        cpu_base->nr_hangs++;
        cpu_base->hang_detected = 1;
+       raw_spin_unlock(&cpu_base->lock);
        delta = ktime_sub(now, entry_time);
        if (delta.tv64 > cpu_base->max_hang_time.tv64)
                cpu_base->max_hang_time = delta;