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

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

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
This commit is contained in:
Axel Lin 2013-08-30 16:31:25 +08:00 committed by Linus Walleij
parent 07b7eb9279
commit c9e3b2d8f7
1 changed files with 1 additions and 1 deletions

View File

@ -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");