aboutsummaryrefslogtreecommitdiff
path: root/nuttx/sched
diff options
context:
space:
mode:
Diffstat (limited to 'nuttx/sched')
-rw-r--r--nuttx/sched/sched_waitpid.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/nuttx/sched/sched_waitpid.c b/nuttx/sched/sched_waitpid.c
index e8e2f61a2..692ef6410 100644
--- a/nuttx/sched/sched_waitpid.c
+++ b/nuttx/sched/sched_waitpid.c
@@ -178,7 +178,7 @@
pid_t waitpid(pid_t pid, int *stat_loc, int options)
{
- _TCB *tcb = sched_gettcb(pid);
+ _TCB *tcb;
bool mystat;
int err;
int ret;
@@ -186,6 +186,7 @@ pid_t waitpid(pid_t pid, int *stat_loc, int options)
/* Disable pre-emption so that nothing changes in the following tests */
sched_lock();
+ tcb = sched_gettcb(pid);
if (!tcb)
{
err = ECHILD;