From 333f9426f6d4239e33f39da0b2217c58f6fa9046 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Thu, 10 Jul 2014 12:49:43 +0200 Subject: score: Fix assertions --- cpukit/score/include/rtems/score/schedulerpriorityimpl.h | 5 ++++- cpukit/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 a1aa779721..ab5abdc65f 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 3cf7861d3b..a4890df4d0 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 084d78251f..733f3dbe9f 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( -- cgit v1.2.3