[rtems commit] score: Simplify _MRSP_Wait_for_ownership()

Sebastian Huber sebh at rtems.org
Mon Feb 1 06:20:12 UTC 2021


Module:    rtems
Branch:    master
Commit:    3dcdb9c9e3c3328112ba17e717f812bffc7870f2
Changeset: http://git.rtems.org/rtems/commit/?id=3dcdb9c9e3c3328112ba17e717f812bffc7870f2

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Thu Jan 28 12:55:52 2021 +0100

score: Simplify _MRSP_Wait_for_ownership()

Do not shadow the queue_context parameter with a local variable.  Reuse
the queue context to reduce the required stack space.

This fix relates to a Coverity issue (PW.PARAMETER_HIDDEN).

---

 cpukit/include/rtems/score/mrspimpl.h | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/cpukit/include/rtems/score/mrspimpl.h b/cpukit/include/rtems/score/mrspimpl.h
index 4af7d03..3cd5bcf 100644
--- a/cpukit/include/rtems/score/mrspimpl.h
+++ b/cpukit/include/rtems/score/mrspimpl.h
@@ -367,9 +367,8 @@ RTEMS_INLINE_ROUTINE Status_Control _MRSP_Wait_for_ownership(
   if ( status == STATUS_SUCCESSFUL ) {
     _MRSP_Replace_priority( mrsp, executing, &ceiling_priority );
   } else {
-    Thread_queue_Context  queue_context;
-    Per_CPU_Control      *cpu_self;
-    int                   sticky_level_change;
+    Per_CPU_Control *cpu_self;
+    int              sticky_level_change;
 
     if ( status != STATUS_DEADLOCK ) {
       sticky_level_change = -1;
@@ -377,12 +376,12 @@ RTEMS_INLINE_ROUTINE Status_Control _MRSP_Wait_for_ownership(
       sticky_level_change = 0;
     }
 
-    _ISR_lock_ISR_disable( &queue_context.Lock_context.Lock_context );
-    _MRSP_Remove_priority( executing, &ceiling_priority, &queue_context );
+    _ISR_lock_ISR_disable( &queue_context->Lock_context.Lock_context );
+    _MRSP_Remove_priority( executing, &ceiling_priority, queue_context );
     cpu_self = _Thread_Dispatch_disable_critical(
-      &queue_context.Lock_context.Lock_context
+      &queue_context->Lock_context.Lock_context
     );
-    _ISR_lock_ISR_enable( &queue_context.Lock_context.Lock_context );
+    _ISR_lock_ISR_enable( &queue_context->Lock_context.Lock_context );
     _Thread_Priority_and_sticky_update( executing, sticky_level_change );
     _Thread_Dispatch_enable( cpu_self );
   }



More information about the vc mailing list