In rtems_gpio_define_pin_group(), several malloc() calls did not
check their return values. This could lead to NULL pointer
dereferences in later initialization steps.
The previous error handling also leaked memory and hardware pin
resources if an intermediate step.
This patch refactors the error handling path to address these issues.
This code was flagged as maybe-uninitialized when compiling at -Og.
The underlying problem was functional code in an assert(). If
compiled with asserts disabled, there would have been no mutex
lock/unlock. Changed the macros to obtain and release the mutex
independent of assert() being enabled or not and switched to using
the RTEMS assert _Assert() which lets this check follow the
RTEMS_DEBUG setting.
This warning occurs when comparing a signed variable to an unsigned one.
This addresses warnings that only occurred on 64-bit targets. For the
ones which only appeared on 64-bit targets, the cause was frequently
a mismatch when comparing a combination off_t, ssize_t, and int.
GCC generates type limit warnings when comparison is always true or
always false due to the limited range of the data type, This was in a
termios structure. For most of the cases in RTEMS, this was when
a variable of an unsigned type was compared to be < or <= 0.
GCC currently has issues with false positive warnings about array bounds
violations when the value used as the index is a pointer. This slightly
reworks the code to make it cleaner and to avoid this warning.