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

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

commit 45b1db24903ffcf4a3e0d075b5e6aeb4a7fec5b9
Author: makejian <[email protected]>
AuthorDate: Wed Nov 25 13:21:23 2026 +0800

    signal: fix nxsig_dispatch misra coverity
    
    Keep one exit path in nxsig_dispatch(): hold the result in a local
    variable for the group dispatch and the thread dispatch instead of
    returning from the middle of the function, as the MISRA C:2012
    guidelines require.
    
    The group lookup by process pid and the thread lookup by tid that
    master performs are unchanged.
    
    Signed-off-by: makejian <[email protected]>
    Signed-off-by: zhangyuan29 <[email protected]>
---
 sched/signal/sig_dispatch.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/sched/signal/sig_dispatch.c b/sched/signal/sig_dispatch.c
index 589e02bccba..8318cc1b33a 100644
--- a/sched/signal/sig_dispatch.c
+++ b/sched/signal/sig_dispatch.c
@@ -1074,6 +1074,8 @@ int nxsig_tcbdispatch(FAR struct tcb_s *stcb, FAR 
siginfo_t *info,
 int nxsig_dispatch(pid_t pid, FAR siginfo_t *info, bool thread,
                    FAR const void *source, bool limit)
 {
+  int ret = -ESRCH;
+
 #ifdef HAVE_GROUP_MEMBERS
   if (!thread)
     {
@@ -1085,7 +1087,7 @@ int nxsig_dispatch(pid_t pid, FAR siginfo_t *info, bool 
thread,
 
       if (group != NULL)
         {
-          return group_signal(group, info, source, limit);
+          ret = group_signal(group, info, source, limit);
         }
     }
   else
@@ -1097,11 +1099,11 @@ int nxsig_dispatch(pid_t pid, FAR siginfo_t *info, bool 
thread,
 
       if (stcb != NULL)
         {
-          return nxsig_tcbdispatch(stcb, info, false, source, limit);
+          ret = nxsig_tcbdispatch(stcb, info, false, source, limit);
         }
     }
 
-  return -ESRCH;
+  return ret;
 }
 
 /****************************************************************************

Reply via email to