]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
pinctrl: sunxi: Fix off-by-one for valid offset range checking
authorAxel Lin <axel.lin@ingics.com>
Fri, 30 Aug 2013 08:31:25 +0000 (16:31 +0800)
committerLinus Walleij <linus.walleij@linaro.org>
Fri, 30 Aug 2013 08:37:36 +0000 (10:37 +0200)
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>
drivers/pinctrl/pinctrl-sunxi.c

index 4432e5e062c5af219f23678c625665092fc794be..119d2ddedfe70c2aed27398289c8d1b2b484b160 100644 (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");