bsps/shared/gpio: Fix array bounds warning

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.
This commit is contained in:
Kinsey Moore
2025-07-31 18:13:12 -05:00
committed by Kinsey Moore
parent 75312c1b9b
commit f18fc04657
+3 -4
View File
@@ -317,15 +317,14 @@ static rtems_status_code get_pin_bitmask(
return RTEMS_INVALID_ID;
}
bank = BANK_NUMBER(pin_number);
if ( i == 0 ) {
bank = BANK_NUMBER(pin_number);
*bank_number = bank;
ACQUIRE_LOCK(gpio_bank_state[bank].lock);
}
else if ( bank != *bank_number ) {
RELEASE_LOCK(gpio_bank_state[*bank_number].lock);
else if ( bank != BANK_NUMBER(pin_number) ) {
RELEASE_LOCK(gpio_bank_state[bank].lock);
return RTEMS_UNSATISFIED;
}