rp2040: Fix boundary check for max gpio pin

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor committed 2022-11-19 10:13:50 -05:00
1 parent d17ef95a3c
commit b9a378c1ca
1 file changed
+2 -2
+2 -2
View File
@@ -48,7 +48,7 @@ mask_to_pin(uint32_t mask)
struct gpio_out
gpio_out_setup(uint8_t pin, uint8_t val)
{
if (pin > 30)
if (pin >= 30)
goto fail;
struct gpio_out g = { .bit=1<<pin };
gpio_out_reset(g, val);
@@ -93,7 +93,7 @@ gpio_out_write(struct gpio_out g, uint8_t val)
struct gpio_in
gpio_in_setup(uint8_t pin, int8_t pull_up)
{
if (pin > 30)
if (pin >= 30)
goto fail;
struct gpio_in g = { .bit=1<<pin };
gpio_in_reset(g, pull_up);