diff --git a/sched/task/task_exit.c b/sched/task/task_exit.c index a4efb2bc839..b4bb1b84019 100644 --- a/sched/task/task_exit.c +++ b/sched/task/task_exit.c @@ -76,17 +76,11 @@ int nxtask_exit(void) FAR struct tcb_s *rtcb; int ret; #ifdef CONFIG_SMP - int cpu; - - /* Get the current CPU. By assumption, we are within a critical section - * and, hence, the CPU index will remain stable. - * - * Avoid using this_task() because it may assume a state that is not + /* Avoid using this_task() because it may assume a state that is not * appropriate for an exiting task. */ - cpu = this_cpu(); - dtcb = current_task(cpu); + dtcb = current_task(this_cpu()); #else dtcb = this_task(); #endif @@ -111,7 +105,7 @@ int nxtask_exit(void) /* Get the new task at the head of the ready to run list */ #ifdef CONFIG_SMP - rtcb = current_task(cpu); + rtcb = current_task(this_cpu()); #else rtcb = this_task(); #endif