diff --git a/arch b/arch index 839a04f989..414b1da6b1 160000 --- a/arch +++ b/arch @@ -1 +1 @@ -Subproject commit 839a04f989000895820af4691d9596fc4385f48b +Subproject commit 414b1da6b18e57ec4119c0a70f84e7c635243717 diff --git a/sched/sched/sched_addreadytorun.c b/sched/sched/sched_addreadytorun.c index 2ccc5d723b..d80ab456cb 100644 --- a/sched/sched/sched_addreadytorun.c +++ b/sched/sched/sched_addreadytorun.c @@ -171,7 +171,6 @@ bool sched_addreadytorun(FAR struct tcb_s *btcb) bool sched_addreadytorun(FAR struct tcb_s *btcb) { FAR struct tcb_s *rtcb; - FAR struct tcb_s *next; FAR dq_queue_t *tasklist; int task_state; int cpu; @@ -305,7 +304,7 @@ bool sched_addreadytorun(FAR struct tcb_s *btcb) * and check if a context switch will occur */ - tasklist = (FAR dq_queue_t *)g_assignedtasks[cpu].head; + tasklist = (FAR dq_queue_t *)&g_assignedtasks[cpu]; switched = sched_addprioritized(btcb, tasklist); /* If the selected task was the g_assignedtasks[] list, then a context @@ -314,6 +313,8 @@ bool sched_addreadytorun(FAR struct tcb_s *btcb) if (switched) { + FAR struct tcb_s *next; + /* The new btcb was added at the head of the ready-to-run list. It * is now the new active task! * @@ -375,7 +376,7 @@ bool sched_addreadytorun(FAR struct tcb_s *btcb) next = (FAR struct tcb_s *)btcb->flink; ASSERT(!rtcb->lockcount && next != NULL); - if ((btcb->flags & TCB_FLAG_CPU_ASSIGNED) != 0) + if ((next->flags & TCB_FLAG_CPU_ASSIGNED) != 0) { next->task_state = TSTATE_TASK_ASSIGNED; } @@ -390,7 +391,7 @@ bool sched_addreadytorun(FAR struct tcb_s *btcb) */ next->task_state = TSTATE_TASK_READYTORUN; - (void)sched_addprioritized(btcb, + (void)sched_addprioritized(next, (FAR dq_queue_t *)&g_readytorun); }