Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c9e3b2d8 authored by Axel Lin's avatar Axel Lin Committed by Linus Walleij
Browse files

pinctrl: sunxi: Fix off-by-one for valid offset range checking



The valid offset range should be 0 ... chip->ngpio - 1.

Signed-off-by: default avatarAxel Lin <axel.lin@ingics.com>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 07b7eb92
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -521,7 +521,7 @@ static int sunxi_pinctrl_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
	struct sunxi_pinctrl *pctl = dev_get_drvdata(chip->dev);
	struct sunxi_desc_function *desc;

	if (offset > chip->ngpio)
	if (offset >= chip->ngpio)
		return -ENXIO;

	desc = sunxi_pinctrl_desc_find_function_by_pin(pctl, offset, "irq");