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 c9f460d793d2be7a87ded0f8024da6a5f6b789f5
Author: fangxinyong <[email protected]>
AuthorDate: Sun Aug 17 14:11:05 2025 +0800

    task_task_cancelpt.c:coverity HIS_metric_violation: RETURN
    
    Replace early return with a ret flag to unify the exit path.
    Keep critical section behavior unchanged while simplifying control flow.
    Addresses Coverity HIS_metric_violation: RETURN.
    
    Signed-off-by: fangxinyong <[email protected]>
---
 sched/task/task_cancelpt.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/sched/task/task_cancelpt.c b/sched/task/task_cancelpt.c
index 74d62c255df..6440170ada2 100644
--- a/sched/task/task_cancelpt.c
+++ b/sched/task/task_cancelpt.c
@@ -125,14 +125,13 @@ bool nxnotify_cancellation(FAR struct tcb_s *tcb)
        */
 
       tls->tl_cpstate |= CANCEL_FLAG_CANCEL_PENDING;
-      leave_critical_section(flags);
-      return true;
+      ret = true;
     }
 
 #ifdef CONFIG_CANCELLATION_POINTS
   /* Check if this task supports deferred cancellation */
 
-  if ((tls->tl_cpstate & CANCEL_FLAG_CANCEL_ASYNC) == 0)
+  if (!ret && (tls->tl_cpstate & CANCEL_FLAG_CANCEL_ASYNC) == 0)
     {
       /* Then we cannot cancel the task asynchronously. */
 

Reply via email to