mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2026-09-20 21:08:51 +08:00
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:
committed by
Kinsey Moore
parent
75312c1b9b
commit
f18fc04657
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user