This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 87d6084f3164174b352a0889bea55298882b84aa
Author: chao an <[email protected]>
AuthorDate: Tue Oct 24 22:27:33 2023 +0800

    sched: fix the minor style issue
    
    and remove the unused return value
    
    Signed-off-by: chao an <[email protected]>
---
 sched/clock/clock_adjtime.c        | 6 ++++--
 sched/group/group_create.c         | 3 ++-
 sched/group/group_setupidlefiles.c | 3 +--
 sched/group/group_setuptaskfiles.c | 5 -----
 sched/pthread/pthread_detach.c     | 2 +-
 sched/task/task_delete.c           | 9 +--------
 6 files changed, 9 insertions(+), 19 deletions(-)

diff --git a/sched/clock/clock_adjtime.c b/sched/clock/clock_adjtime.c
index 3d8941dfac..db538ef0f8 100644
--- a/sched/clock/clock_adjtime.c
+++ b/sched/clock/clock_adjtime.c
@@ -119,8 +119,6 @@ int adjtime(FAR const struct timeval *delta, FAR struct 
timeval *olddelta)
   long long incr_limit;
   int is_negative;
 
-  is_negative = 0;
-
   if (!delta)
     {
       set_errno(EINVAL);
@@ -136,6 +134,10 @@ int adjtime(FAR const struct timeval *delta, FAR struct 
timeval *olddelta)
       adjust_usec = -adjust_usec;
       is_negative = 1;
     }
+  else
+    {
+      is_negative = 0;
+    }
 
   /* Get period in usec. Target hardware has to provide support for
    * this function call.
diff --git a/sched/group/group_create.c b/sched/group/group_create.c
index fb81eff718..735d39b72e 100644
--- a/sched/group/group_create.c
+++ b/sched/group/group_create.c
@@ -129,7 +129,7 @@ static inline void group_inherit_identity(FAR struct 
task_group_s *group)
 int group_allocate(FAR struct task_tcb_s *tcb, uint8_t ttype)
 {
   FAR struct task_group_s *group;
-  int ret = -ENOMEM;
+  int ret;
 
   DEBUGASSERT(tcb && !tcb->cmn.group);
 
@@ -158,6 +158,7 @@ int group_allocate(FAR struct task_tcb_s *tcb, uint8_t 
ttype)
   group->tg_members = kmm_malloc(GROUP_INITIAL_MEMBERS * sizeof(pid_t));
   if (!group->tg_members)
     {
+      ret = -ENOMEM;
       goto errout_with_group;
     }
 
diff --git a/sched/group/group_setupidlefiles.c 
b/sched/group/group_setupidlefiles.c
index b79b8dbd35..2a670966f4 100644
--- a/sched/group/group_setupidlefiles.c
+++ b/sched/group/group_setupidlefiles.c
@@ -59,7 +59,6 @@
 
 int group_setupidlefiles(void)
 {
-  int ret = OK;
 #if defined(CONFIG_DEV_CONSOLE) || defined(CONFIG_DEV_NULL)
   int fd;
 #endif
@@ -115,5 +114,5 @@ int group_setupidlefiles(void)
 #endif /* defined(CONFIG_DEV_CONSOLE) || defined(CONFIG_DEV_NULL) */
 
   sched_trace_end();
-  return ret;
+  return OK;
 }
diff --git a/sched/group/group_setuptaskfiles.c 
b/sched/group/group_setuptaskfiles.c
index 95c7a7f8ad..1345252f2e 100644
--- a/sched/group/group_setuptaskfiles.c
+++ b/sched/group/group_setuptaskfiles.c
@@ -76,11 +76,6 @@ int group_setuptaskfiles(FAR struct task_tcb_s *tcb)
   /* Duplicate the parent task's file descriptors */
 
   ret = files_duplist(&rtcb->group->tg_filelist, &group->tg_filelist);
-  if (ret < 0)
-    {
-      sched_trace_end();
-      return ret;
-    }
 #endif
 
   sched_trace_end();
diff --git a/sched/pthread/pthread_detach.c b/sched/pthread/pthread_detach.c
index 5aff4a9c76..f1476515ff 100644
--- a/sched/pthread/pthread_detach.c
+++ b/sched/pthread/pthread_detach.c
@@ -65,7 +65,7 @@ int pthread_detach(pthread_t thread)
   FAR struct tcb_s *rtcb = this_task();
   FAR struct task_group_s *group = rtcb->group;
   FAR struct join_s *pjoin;
-  int ret = OK;
+  int ret;
 
   sinfo("Thread=%d group=%p\n", thread, group);
   DEBUGASSERT(group);
diff --git a/sched/task/task_delete.c b/sched/task/task_delete.c
index 6c2330e5dd..b71670bd0d 100644
--- a/sched/task/task_delete.c
+++ b/sched/task/task_delete.c
@@ -66,7 +66,6 @@ int nxtask_delete(pid_t pid)
 {
   FAR struct tcb_s *dtcb;
   FAR struct tcb_s *rtcb;
-  int ret;
 
   /* Check if the task to delete is the calling task:  PID=0 means to delete
    * the calling task.  In this case, task_delete() is much like exit()
@@ -132,13 +131,7 @@ int nxtask_delete(pid_t pid)
    * nxtask_terminate() do all of the heavy lifting.
    */
 
-  ret = nxtask_terminate(pid);
-  if (ret < 0)
-    {
-      return ret;
-    }
-
-  return OK;
+  return nxtask_terminate(pid);
 }
 
 /****************************************************************************

Reply via email to