Skip to content
Browse files

debug: tracing: Rewrite assert on current_thread in CPU stats module

The function sys_trace_thread_switched_out asserts in case
sys_trace_thread_switched_in was not called first. This is unintended
as tracing.h describes that out should be called before in, thus the
reverse of what the assert expects.
Fix assert on initial thread switch in, where out is called with
current_thread being NULL.

Signed-off-by: Danny Oerndrup <>
  • Loading branch information...
daor-oti authored and aescolar committed Jul 5, 2019
1 parent 49cf486 commit 74da4393224b2f64595b32edd219a3a228eb6495
Showing with 1 addition and 1 deletion.
  1. +1 −1 subsys/debug/tracing/cpu_stats.c
@@ -123,7 +123,7 @@ void sys_trace_thread_switched_out(void)
int key = irq_lock();

__ASSERT_NO_MSG(nested_interrupts == 0);
__ASSERT_NO_MSG(current_thread == k_current_get());
__ASSERT_NO_MSG(!current_thread || (current_thread == k_current_get()));

last_cpu_state = CPU_STATE_SCHEDULER;

0 comments on commit 74da439

Please sign in to comment.
You can’t perform that action at this time.