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

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

commit 0aaec9d49399a50570cef5d0d71a5a6921c8622d
Author: yushuailong <[email protected]>
AuthorDate: Wed Aug 26 00:48:36 2026 +0800

    sched/setparam: update sporadic parameters of the target task
    
    set_sporadic_param() tested rtcb (the calling task) instead of tcb (the
    task being modified).  A cross-task sched_setparam() therefore either
    skipped the sporadic parameter update entirely or, when the calling
    task was itself sporadic, reset a task that had no sporadic state.
    
    Use tcb consistently and drop the now-unused rtcb argument.
    
    Signed-off-by: yushuailong <[email protected]>
---
 sched/sched/sched_setparam.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/sched/sched/sched_setparam.c b/sched/sched/sched_setparam.c
index 586ad7463cc..11faeb45e10 100644
--- a/sched/sched/sched_setparam.c
+++ b/sched/sched/sched_setparam.c
@@ -45,14 +45,14 @@
 #ifdef CONFIG_SCHED_SPORADIC
 static inline_function
 int set_sporadic_param(FAR const struct sched_param *param,
-                       FAR struct tcb_s *rtcb, FAR struct tcb_s *tcb)
+                       FAR struct tcb_s *tcb)
 {
   irqstate_t flags;
   int ret = OK;
 
   /* Update parameters associated with SCHED_SPORADIC */
 
-  if ((rtcb->flags & TCB_FLAG_POLICY_MASK) == TCB_FLAG_SCHED_SPORADIC)
+  if ((tcb->flags & TCB_FLAG_POLICY_MASK) == TCB_FLAG_SCHED_SPORADIC)
     {
       FAR struct sporadic_s *sporadic;
       clock_t repl_ticks;
@@ -104,7 +104,7 @@ int set_sporadic_param(FAR const struct sched_param *param,
 
                   tcb->timeslice         = budget_ticks;
 
-                  sporadic = rtcb->sporadic;
+                  sporadic = tcb->sporadic;
                   DEBUGASSERT(sporadic != NULL);
 
                   sporadic->hi_priority  = param->sched_priority;
@@ -136,7 +136,7 @@ int set_sporadic_param(FAR const struct sched_param *param,
   return ret;
 }
 #else
-#  define set_sporadic_param(p, r, t) OK
+#  define set_sporadic_param(p, t) OK
 #endif
 
 /****************************************************************************
@@ -216,7 +216,7 @@ int nxsched_set_param(pid_t pid, FAR const struct 
sched_param *param)
 
       if (ret >= 0)
         {
-          ret = set_sporadic_param(param, rtcb, tcb);
+          ret = set_sporadic_param(param, tcb);
         }
 
       /* Then perform the reprioritization */
@@ -271,6 +271,7 @@ int nxsched_set_param(pid_t pid, FAR const struct 
sched_param *param)
 int sched_setparam(pid_t pid, FAR const struct sched_param *param)
 {
   int ret = nxsched_set_param(pid, param);
+
   if (ret < 0)
     {
       set_errno(-ret);

Reply via email to