These 3 look good to me
On Tue, Mar 16, 2021 at 7:58 AM Sebastian Huber <sebastian.hu...@embedded-brains.de> wrote: > > Do not mix checks for different error indicators (RTEMS_NOT_DEFINED and > RTEMS_INVALID_NUMBER). This simplifies the specification of > rtems_semaphore_create(). > --- > cpukit/rtems/src/semcreate.c | 10 ++++------ > 1 file changed, 4 insertions(+), 6 deletions(-) > > diff --git a/cpukit/rtems/src/semcreate.c b/cpukit/rtems/src/semcreate.c > index 0246c91bc9..b58ea0199f 100644 > --- a/cpukit/rtems/src/semcreate.c > +++ b/cpukit/rtems/src/semcreate.c > @@ -72,12 +72,6 @@ rtems_status_code rtems_semaphore_create( > > if ( maybe_global == RTEMS_COUNTING_SEMAPHORE ) { > variant = SEMAPHORE_VARIANT_COUNTING; > - } else if ( count > 1 ) { > - /* > - * The remaining variants are all binary semphores, thus reject an > invalid > - * count value. > - */ > - return RTEMS_INVALID_NUMBER; > } else if ( maybe_global == RTEMS_SIMPLE_BINARY_SEMAPHORE ) { > variant = SEMAPHORE_VARIANT_SIMPLE_BINARY; > } else if ( maybe_global == RTEMS_BINARY_SEMAPHORE ) { > @@ -109,6 +103,10 @@ rtems_status_code rtems_semaphore_create( > return RTEMS_NOT_DEFINED; > } > > + if ( count > 1 && variant != SEMAPHORE_VARIANT_COUNTING ) { > + return RTEMS_INVALID_NUMBER; > + } > + > the_semaphore = _Semaphore_Allocate(); > > if ( !the_semaphore ) { > -- > 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