From: Axel Lin Date: Fri, 30 Aug 2013 08:31:25 +0000 (+0800) Subject: pinctrl: sunxi: Fix off-by-one for valid offset range checking X-Git-Tag: v3.12-rc1~151^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c9e3b2d8f75d84c7b333761471f6cef98ec4429a;p=profile%2Fivi%2Fkernel-x86-ivi.git 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 Signed-off-by: Linus Walleij --- diff --git a/drivers/pinctrl/pinctrl-sunxi.c b/drivers/pinctrl/pinctrl-sunxi.c index 4432e5e..119d2dd 100644 --- a/drivers/pinctrl/pinctrl-sunxi.c +++ b/drivers/pinctrl/pinctrl-sunxi.c @@ -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");