diff options
| author | Jeff Epler <jepler@gmail.com> | 2020-06-16 11:31:07 -0500 |
|---|---|---|
| committer | Jeff Epler <jepler@gmail.com> | 2020-06-22 10:45:27 -0500 |
| commit | a770b5a919338b9df068bd0bca14edec9996bc31 (patch) | |
| tree | 8e2b1f8e74e532c123ef7f3daf3b9f476eb19de4 | |
| parent | 6638bc32c3c989c3bd4ffc761bd1462ed06828be (diff) | |
never_reset_pin: Move pin validity check before first use of pin number
| -rw-r--r-- | ports/atmel-samd/common-hal/microcontroller/Pin.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/ports/atmel-samd/common-hal/microcontroller/Pin.c b/ports/atmel-samd/common-hal/microcontroller/Pin.c index cf78673b2..3c214a9f4 100644 --- a/ports/atmel-samd/common-hal/microcontroller/Pin.c +++ b/ports/atmel-samd/common-hal/microcontroller/Pin.c @@ -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; |
