never_reset_pin: Move pin validity check before first use of pin number

This commit is contained in:
Jeff Epler 2020-06-16 11:31:07 -05:00
parent 6638bc32c3
commit a770b5a919

View File

@ -110,12 +110,12 @@ void never_reset_pin_number(uint8_t pin_number) {
}
void reset_pin_number(uint8_t pin_number) {
never_reset_pins[GPIO_PORT(pin_number)] &= ~(1 << GPIO_PIN(pin_number));
if (pin_number >= PORT_BITS) {
return;
}
never_reset_pins[GPIO_PORT(pin_number)] &= ~(1 << GPIO_PIN(pin_number));
#ifdef MICROPY_HW_NEOPIXEL
if (pin_number == MICROPY_HW_NEOPIXEL->number) {
neopixel_in_use = false;