From 3c84278aa742e398115c724f87e29fb1fe91758f Mon Sep 17 00:00:00 2001 From: Xiang Xiao Date: Sun, 3 May 2020 19:56:49 +0800 Subject: [PATCH] sched: task_init as internal function shouldn't modify errno Signed-off-by: Xiang Xiao --- binfmt/binfmt_execmodule.c | 1 - sched/task/task_init.c | 10 ++-------- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/binfmt/binfmt_execmodule.c b/binfmt/binfmt_execmodule.c index 88f1eddd45..dd19c829be 100644 --- a/binfmt/binfmt_execmodule.c +++ b/binfmt/binfmt_execmodule.c @@ -170,7 +170,6 @@ int exec_module(FAR const struct binary_s *binp) stack, binp->stacksize, binp->entrypt, binp->argv); if (ret < 0) { - ret = -get_errno(); berr("task_init() failed: %d\n", ret); kumm_free(stack); goto errout_with_addrenv; diff --git a/sched/task/task_init.c b/sched/task/task_init.c index d544508be2..08462aba34 100644 --- a/sched/task/task_init.c +++ b/sched/task/task_init.c @@ -65,7 +65,7 @@ * parameters are required, argv may be NULL. * * Returned Value: - * OK on success; ERROR on failure with errno set appropriately. (See + * OK on success; negative error value on failure appropriately. (See * nxtask_schedsetup() for possible failure conditions). On failure, the * caller is responsible for freeing the stack memory and for calling * sched_releasetcb() to free the TCB (which could be in most any state). @@ -77,7 +77,6 @@ int task_init(FAR struct tcb_s *tcb, const char *name, int priority, main_t entry, FAR char * const argv[]) { FAR struct task_tcb_s *ttcb = (FAR struct task_tcb_s *)tcb; - int errcode; int ret; /* Only tasks and kernel threads can be initialized in this way */ @@ -92,7 +91,6 @@ int task_init(FAR struct tcb_s *tcb, const char *name, int priority, ret = group_allocate(ttcb, tcb->flags); if (ret < 0) { - errcode = -ret; goto errout; } @@ -101,7 +99,6 @@ int task_init(FAR struct tcb_s *tcb, const char *name, int priority, ret = group_setuptaskfiles(ttcb); if (ret < 0) { - errcode = -ret; goto errout_with_group; } @@ -115,7 +112,6 @@ int task_init(FAR struct tcb_s *tcb, const char *name, int priority, TCB_FLAG_TTYPE_TASK); if (ret < OK) { - errcode = -ret; goto errout_with_group; } @@ -128,7 +124,6 @@ int task_init(FAR struct tcb_s *tcb, const char *name, int priority, ret = group_initialize(ttcb); if (ret < 0) { - errcode = -ret; goto errout_with_group; } @@ -138,6 +133,5 @@ errout_with_group: group_leave(tcb); errout: - set_errno(errcode); - return ERROR; + return ret; }