[rtems commit] score: Fix assertions

Sebastian Huber sebh at rtems.org
Thu Jul 10 14:56:49 UTC 2014


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

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Thu Jul 10 12:49:43 2014 +0200

score: Fix assertions

---

 .../include/rtems/score/schedulerpriorityimpl.h    |    5 ++++-
 .../score/include/rtems/score/schedulersmpimpl.h   |    4 ----
 cpukit/score/src/schedulersimplesmp.c              |    5 ++++-
 3 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/cpukit/score/include/rtems/score/schedulerpriorityimpl.h b/cpukit/score/include/rtems/score/schedulerpriorityimpl.h
index a1aa779..ab5abdc 100644
--- a/cpukit/score/include/rtems/score/schedulerpriorityimpl.h
+++ b/cpukit/score/include/rtems/score/schedulerpriorityimpl.h
@@ -161,8 +161,11 @@ RTEMS_INLINE_ROUTINE Chain_Node *_Scheduler_priority_Ready_queue_first(
 )
 {
   Priority_Control index = _Priority_bit_map_Get_highest( bit_map );
+  Chain_Node *first = _Chain_First( &ready_queues[ index ] );
 
-  return _Chain_First( &ready_queues[ index ] );
+  _Assert( first != _Chain_Tail( &ready_queues[ index ] ) );
+
+  return first;
 }
 
 /**
diff --git a/cpukit/score/include/rtems/score/schedulersmpimpl.h b/cpukit/score/include/rtems/score/schedulersmpimpl.h
index 3cf7861..a4890df 100644
--- a/cpukit/score/include/rtems/score/schedulersmpimpl.h
+++ b/cpukit/score/include/rtems/score/schedulersmpimpl.h
@@ -678,8 +678,6 @@ static inline Thread_Control *_Scheduler_SMP_Enqueue_scheduled_ordered(
   while ( true ) {
     Scheduler_Node *highest_ready = ( *get_highest_ready )( context, node );
 
-    _Assert( highest_ready != NULL );
-
     /*
      * The node has been extracted from the scheduled chain.  We have to place
      * it now on the scheduled or ready set.
@@ -761,8 +759,6 @@ static inline void _Scheduler_SMP_Schedule_highest_ready(
   while ( true ) {
     Scheduler_Node *highest_ready = ( *get_highest_ready )( context, victim );
 
-    _Assert( highest_ready != NULL );
-
     if (
       _Scheduler_Try_to_schedule_node(
         context,
diff --git a/cpukit/score/src/schedulersimplesmp.c b/cpukit/score/src/schedulersimplesmp.c
index 084d782..733f3db 100644
--- a/cpukit/score/src/schedulersimplesmp.c
+++ b/cpukit/score/src/schedulersimplesmp.c
@@ -84,10 +84,13 @@ static Scheduler_Node *_Scheduler_simple_SMP_Get_highest_ready(
 {
   Scheduler_simple_SMP_Context *self =
     _Scheduler_simple_SMP_Get_self( context );
+  Scheduler_Node *first = (Scheduler_Node *) _Chain_First( &self->Ready );
 
   (void) node;
 
-  return (Scheduler_Node *) _Chain_First( &self->Ready );
+  _Assert( &first->Node != _Chain_Tail( &self->Ready ) );
+
+  return first;
 }
 
 static void _Scheduler_simple_SMP_Move_from_scheduled_to_ready(



More information about the vc mailing list