From 7582c2344c9cae4aeb9e888b90b491020c6ef0df Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Tue, 6 Sep 2016 10:28:19 -0600 Subject: [PATCH] sched/: Eliminate calculation of a possibly unused value. --- sched/task/task_setup.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/sched/task/task_setup.c b/sched/task/task_setup.c index 4f0e3e6542..553ddd8fa6 100644 --- a/sched/task/task_setup.c +++ b/sched/task/task_setup.c @@ -201,10 +201,7 @@ static inline void task_inherit_affinity(FAR struct tcb_s *tcb) #ifdef CONFIG_SCHED_HAVE_PARENT static inline void task_saveparent(FAR struct tcb_s *tcb, uint8_t ttype) { - FAR struct tcb_s *rtcb = this_task(); - - DEBUGASSERT( tcb != NULL && tcb->group != NULL && - rtcb != NULL && rtcb->group != NULL); + DEBUGASSERT(tcb != NULL && tcb->group != NULL); /* Only newly created tasks (and kernel threads) have parents. None of * this logic applies to pthreads with reside in the same group as the @@ -215,6 +212,12 @@ static inline void task_saveparent(FAR struct tcb_s *tcb, uint8_t ttype) if ((tcb->flags & TCB_FLAG_TTYPE_MASK) != TCB_FLAG_TTYPE_PTHREAD) #endif { + /* Get the TCB of the parent task. In this case, the calling task. */ + + FAR struct tcb_s *rtcb = this_task(); + + DEBUGASSERT(rtcb != NULL && rtcb->group != NULL); + #ifdef HAVE_GROUP_MEMBERS /* Save the ID of the parent tasks' task group in the child's task * group. Copy the ID from the parent's task group structure to @@ -224,8 +227,6 @@ static inline void task_saveparent(FAR struct tcb_s *tcb, uint8_t ttype) tcb->group->tg_pgid = rtcb->group->tg_gid; #else - DEBUGASSERT(tcb != NULL && tcb->group != NULL); - /* Save the parent task's ID in the child task's group. */ tcb->group->tg_ppid = rtcb->pid;