diff --git a/binfmt/binfmt_execmodule.c b/binfmt/binfmt_execmodule.c index 519e97bd5f..9c1ee0f246 100644 --- a/binfmt/binfmt_execmodule.c +++ b/binfmt/binfmt_execmodule.c @@ -198,7 +198,7 @@ int exec_module(FAR const struct binary_s *binp) } #endif -#if defined(CONFIG_BUILD_KERNEL) && defined(CONFIG_MM_SHM) +#ifdef CONFIG_MM_SHM /* Initialize the shared memory virtual page allocator */ ret = shm_group_initialize(tcb->cmn.group); @@ -254,12 +254,7 @@ int exec_module(FAR const struct binary_s *binp) /* Then activate the task at the provided priority */ - ret = nxtask_activate((FAR struct tcb_s *)tcb); - if (ret < 0) - { - berr("nxtask_activate() failed: %d\n", ret); - goto errout_with_tcbinit; - } + nxtask_activate((FAR struct tcb_s *)tcb); #if defined(CONFIG_ARCH_ADDRENV) && defined(CONFIG_BUILD_KERNEL) /* Restore the address environment of the caller */ @@ -274,11 +269,13 @@ int exec_module(FAR const struct binary_s *binp) return (int)pid; +#if defined(CONFIG_ARCH_ADDRENV) || defined(CONFIG_MM_SHM) errout_with_tcbinit: tcb->cmn.stack_alloc_ptr = NULL; nxsched_release_tcb(&tcb->cmn, TCB_FLAG_TTYPE_TASK); kumm_free(stack); return ret; +#endif errout_with_addrenv: #if defined(CONFIG_ARCH_ADDRENV) && defined(CONFIG_BUILD_KERNEL) diff --git a/include/nuttx/sched.h b/include/nuttx/sched.h index a2c5778f84..e9650d57b6 100644 --- a/include/nuttx/sched.h +++ b/include/nuttx/sched.h @@ -989,11 +989,11 @@ void nxtask_uninit(FAR struct tcb_s *tcb); * argument). * * Returned Value: - * Always returns OK + * None * ********************************************************************************/ -int nxtask_activate(FAR struct tcb_s *tcb); +void nxtask_activate(FAR struct tcb_s *tcb); /******************************************************************************** * Name: nxtask_starthook diff --git a/sched/pthread/pthread_create.c b/sched/pthread/pthread_create.c index 7526d84026..daef024476 100644 --- a/sched/pthread/pthread_create.c +++ b/sched/pthread/pthread_create.c @@ -553,11 +553,8 @@ int pthread_create(FAR pthread_t *thread, FAR const pthread_attr_t *attr, sched_lock(); if (ret == OK) { - ret = nxtask_activate((FAR struct tcb_s *)ptcb); - } + nxtask_activate((FAR struct tcb_s *)ptcb); - if (ret == OK) - { /* Wait for the task to actually get running and to register * its join structure. */ diff --git a/sched/task/task_activate.c b/sched/task/task_activate.c index 04c60ebb46..27f53137c6 100644 --- a/sched/task/task_activate.c +++ b/sched/task/task_activate.c @@ -49,11 +49,11 @@ * argument). * * Returned Value: - * Always returns OK + * None * ****************************************************************************/ -int nxtask_activate(FAR struct tcb_s *tcb) +void nxtask_activate(FAR struct tcb_s *tcb) { irqstate_t flags = enter_critical_section(); @@ -79,5 +79,4 @@ int nxtask_activate(FAR struct tcb_s *tcb) up_unblock_task(tcb); leave_critical_section(flags); - return OK; } diff --git a/sched/task/task_create.c b/sched/task/task_create.c index 873f7588a3..c2259bea8a 100644 --- a/sched/task/task_create.c +++ b/sched/task/task_create.c @@ -145,12 +145,7 @@ static int nxthread_create(FAR const char *name, uint8_t ttype, /* Activate the task */ - ret = nxtask_activate((FAR struct tcb_s *)tcb); - if (ret < OK) - { - goto errout_with_active; - } - + nxtask_activate((FAR struct tcb_s *)tcb); return pid; errout_with_active: diff --git a/sched/task/task_restart.c b/sched/task/task_restart.c index 88e4007a0e..097a799937 100644 --- a/sched/task/task_restart.c +++ b/sched/task/task_restart.c @@ -73,7 +73,6 @@ int task_restart(pid_t pid) #ifdef CONFIG_SMP int cpu; #endif - int ret; /* Check if the task to restart is the calling task */ @@ -188,7 +187,7 @@ int task_restart(pid_t pid) if (cpu >= 0) { - ret = up_cpu_resume(cpu); + int ret = up_cpu_resume(cpu); if (ret < 0) { errcode = -ret; @@ -201,14 +200,7 @@ int task_restart(pid_t pid) /* Activate the task. */ - ret = nxtask_activate((FAR struct tcb_s *)tcb); - if (ret != OK) - { - nxtask_terminate(pid, true); - errcode = -ret; - goto errout_with_lock; - } - + nxtask_activate((FAR struct tcb_s *)tcb); return OK; errout_with_lock: diff --git a/sched/task/task_vfork.c b/sched/task/task_vfork.c index f7751dde50..ec0a565c0e 100644 --- a/sched/task/task_vfork.c +++ b/sched/task/task_vfork.c @@ -434,13 +434,7 @@ pid_t nxtask_start_vfork(FAR struct task_tcb_s *child) /* Activate the task */ - ret = nxtask_activate((FAR struct tcb_s *)child); - if (ret < OK) - { - nxtask_abort_vfork(child, -ret); - sched_unlock(); - return ERROR; - } + nxtask_activate((FAR struct tcb_s *)child); /* The child task has not yet ran because pre-emption is disabled. * The child task has the same priority as the parent task, so that