these two patches look ok to me.
On Wed, Mar 24, 2021 at 1:40 AM Sebastian Huber <sebastian.hu...@embedded-brains.de> wrote: > > Do not write to the object referenced by old_priority in error paths. > This is in line with other directives. > --- > cpukit/rtems/src/semsetpriority.c | 47 +++++++++++++++---------------- > 1 file changed, 22 insertions(+), 25 deletions(-) > > diff --git a/cpukit/rtems/src/semsetpriority.c > b/cpukit/rtems/src/semsetpriority.c > index 119dd85d77..97e53c6584 100644 > --- a/cpukit/rtems/src/semsetpriority.c > +++ b/cpukit/rtems/src/semsetpriority.c > @@ -29,20 +29,6 @@ > #include <rtems/rtems/tasksimpl.h> > #include <rtems/score/schedulerimpl.h> > > -static rtems_status_code _Semaphore_Is_scheduler_valid( > - const CORE_ceiling_mutex_Control *the_mutex, > - const Scheduler_Control *scheduler > -) > -{ > -#if defined(RTEMS_SMP) > - if ( scheduler != _CORE_ceiling_mutex_Get_scheduler( the_mutex ) ) { > - return RTEMS_NOT_DEFINED; > - } > -#endif > - > - return RTEMS_SUCCESSFUL; > -} > - > static rtems_status_code _Semaphore_Set_priority( > Semaphore_Control *the_semaphore, > const Scheduler_Control *scheduler, > @@ -51,7 +37,6 @@ static rtems_status_code _Semaphore_Set_priority( > Thread_queue_Context *queue_context > ) > { > - rtems_status_code sc; > bool valid; > Priority_Control core_priority; > Priority_Control old_priority; > @@ -73,16 +58,26 @@ static rtems_status_code _Semaphore_Set_priority( > > switch ( variant ) { > case SEMAPHORE_VARIANT_MUTEX_PRIORITY_CEILING: > - sc = _Semaphore_Is_scheduler_valid( > - &the_semaphore->Core_control.Mutex, > - scheduler > - ); > +#if defined(RTEMS_SMP) > + if ( > + scheduler != _CORE_ceiling_mutex_Get_scheduler( > + &the_semaphore->Core_control.Mutex > + ) > + ) { > + _Thread_queue_Release( > + &the_semaphore->Core_control.Wait_queue, > + queue_context > + ); > + > + return RTEMS_NOT_DEFINED; > + } > +#endif > > old_priority = _CORE_ceiling_mutex_Get_priority( > &the_semaphore->Core_control.Mutex > ); > > - if ( sc == RTEMS_SUCCESSFUL && new_priority != RTEMS_CURRENT_PRIORITY > ) { > + if ( new_priority != RTEMS_CURRENT_PRIORITY ) { > _CORE_ceiling_mutex_Set_priority( > &the_semaphore->Core_control.Mutex, > core_priority > @@ -105,7 +100,6 @@ static rtems_status_code _Semaphore_Set_priority( > ); > } > > - sc = RTEMS_SUCCESSFUL; > break; > #endif > default: > @@ -115,9 +109,12 @@ static rtems_status_code _Semaphore_Set_priority( > || variant == SEMAPHORE_VARIANT_SIMPLE_BINARY > || variant == SEMAPHORE_VARIANT_COUNTING > ); > - old_priority = 0; > - sc = RTEMS_NOT_DEFINED; > - break; > + _Thread_queue_Release( > + &the_semaphore->Core_control.Wait_queue, > + queue_context > + ); > + > + return RTEMS_NOT_DEFINED; > } > > cpu_self = _Thread_queue_Dispatch_disable( queue_context ); > @@ -129,7 +126,7 @@ static rtems_status_code _Semaphore_Set_priority( > _Thread_Dispatch_enable( cpu_self ); > > *old_priority_p = _RTEMS_Priority_From_core( scheduler, old_priority ); > - return sc; > + return RTEMS_SUCCESSFUL; > } > > rtems_status_code rtems_semaphore_set_priority( > -- > 2.26.2 > > _______________________________________________ > devel mailing list > devel@rtems.org > http://lists.rtems.org/mailman/listinfo/devel _______________________________________________ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel