diff --git a/sched/semaphore/sem_trywait.c b/sched/semaphore/sem_trywait.c index 7789a63a84f87..fed759db0f33a 100644 --- a/sched/semaphore/sem_trywait.c +++ b/sched/semaphore/sem_trywait.c @@ -62,7 +62,6 @@ static int nxsem_trywait_slow(FAR sem_t *sem) { - FAR struct tcb_s *rtcb; irqstate_t flags; int32_t semcount; int ret; @@ -72,7 +71,6 @@ static int nxsem_trywait_slow(FAR sem_t *sem) */ flags = enter_critical_section(); - rtcb = this_task(); /* If the semaphore is available, give it to the requesting task */ @@ -99,7 +97,6 @@ static int nxsem_trywait_slow(FAR sem_t *sem) } nxsem_add_holder(sem); - rtcb->waitobj = NULL; /* Interrupts may now be enabled. */ diff --git a/sched/semaphore/sem_wait.c b/sched/semaphore/sem_wait.c index 136369d5c3622..e7ba58bf6c647 100644 --- a/sched/semaphore/sem_wait.c +++ b/sched/semaphore/sem_wait.c @@ -70,7 +70,7 @@ static int nxsem_wait_slow(FAR sem_t *sem) { - FAR struct tcb_s *rtcb = this_task(); + FAR struct tcb_s *rtcb; irqstate_t flags; int ret; @@ -98,7 +98,6 @@ static int nxsem_wait_slow(FAR sem_t *sem) } nxsem_add_holder(sem); - rtcb->waitobj = NULL; } /* The semaphore is NOT available, We will have to block the @@ -110,6 +109,7 @@ static int nxsem_wait_slow(FAR sem_t *sem) #ifdef CONFIG_PRIORITY_INHERITANCE uint8_t prioinherit = sem->flags & SEM_PRIO_MASK; #endif + rtcb = this_task(); /* First, verify that the task is not already waiting on a * semaphore