Merge tag 'gpio-updates-for-v5.19' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux-block.git] / drivers / gpio / gpiolib-of.c
index 47c0e07802d6565f8fd9fdb4f7e3e7c1ef5070ec..b7ac07f43b95e24f5430c7df5ab0910a2d616da9 100644 (file)
@@ -909,7 +909,7 @@ static void of_gpiochip_init_valid_mask(struct gpio_chip *chip)
                                           i, &start);
                of_property_read_u32_index(np, "gpio-reserved-ranges",
                                           i + 1, &count);
-               if (start >= chip->ngpio || start + count >= chip->ngpio)
+               if (start >= chip->ngpio || start + count > chip->ngpio)
                        continue;
 
                bitmap_clear(chip->valid_mask, start, count);