sched: remove DEBUGASSERT from nx_waitpid

Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
This commit is contained in:
Petro Karashchenko 2022-04-22 17:14:05 +02:00 committed by Gustavo Henrique Nihei
parent 5a565e753c
commit 1b4d8b3734
2 changed files with 15 additions and 8 deletions

View File

@ -55,8 +55,6 @@ pid_t nx_waitpid(pid_t pid, int *stat_loc, int options)
bool mystat = false; bool mystat = false;
int ret; int ret;
DEBUGASSERT(stat_loc);
/* NOTE: sched_lock() is not enough for SMP /* NOTE: sched_lock() is not enough for SMP
* because the child task is running on another CPU * because the child task is running on another CPU
*/ */
@ -194,8 +192,6 @@ pid_t nx_waitpid(pid_t pid, int *stat_loc, int options)
sigset_t set; sigset_t set;
int ret; int ret;
DEBUGASSERT(stat_loc);
/* Create a signal set that contains only SIGCHLD */ /* Create a signal set that contains only SIGCHLD */
sigemptyset(&set); sigemptyset(&set);
@ -312,7 +308,11 @@ pid_t nx_waitpid(pid_t pid, int *stat_loc, int options)
/* The child has exited. Return the saved exit status */ /* The child has exited. Return the saved exit status */
*stat_loc = child->ch_status << 8; if (stat_loc != NULL)
{
*stat_loc = child->ch_status << 8;
}
pid = child->ch_pid; pid = child->ch_pid;
/* Discard the child entry and break out of the loop */ /* Discard the child entry and break out of the loop */
@ -340,7 +340,10 @@ pid_t nx_waitpid(pid_t pid, int *stat_loc, int options)
{ {
/* The child has exited. Return the saved exit status */ /* The child has exited. Return the saved exit status */
*stat_loc = child->ch_status << 8; if (stat_loc != NULL)
{
*stat_loc = child->ch_status << 8;
}
/* Discard the child entry and break out of the loop */ /* Discard the child entry and break out of the loop */
@ -415,7 +418,11 @@ pid_t nx_waitpid(pid_t pid, int *stat_loc, int options)
{ {
/* Yes... return the status and PID (in the event it was -1) */ /* Yes... return the status and PID (in the event it was -1) */
*stat_loc = info.si_status << 8; if (stat_loc != NULL)
{
*stat_loc = info.si_status << 8;
}
pid = info.si_pid; pid = info.si_pid;
#ifdef CONFIG_SCHED_CHILD_STATUS #ifdef CONFIG_SCHED_CHILD_STATUS

View File

@ -469,7 +469,7 @@ static inline void nxtask_exitwakeup(FAR struct tcb_s *tcb, int status)
* Hmmm.. what do we return to the others? * Hmmm.. what do we return to the others?
*/ */
if (group->tg_statloc) if (group->tg_statloc != NULL)
{ {
*group->tg_statloc = status << 8; *group->tg_statloc = status << 8;
} }