diff options
author | Axel Lin <axel.lin@ingics.com> | 2013-08-30 04:31:25 -0400 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2013-08-30 04:37:36 -0400 |
commit | c9e3b2d8f75d84c7b333761471f6cef98ec4429a (patch) | |
tree | a50f04f05983c912277a6f999c10522a564ff5a8 | |
parent | 07b7eb927994b8e78267a20244ecc9d49fb15d95 (diff) |
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>
-rw-r--r-- | drivers/pinctrl/pinctrl-sunxi.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/pinctrl/pinctrl-sunxi.c b/drivers/pinctrl/pinctrl-sunxi.c index 4432e5e062c5..119d2ddedfe7 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) | |||
521 | struct sunxi_pinctrl *pctl = dev_get_drvdata(chip->dev); | 521 | struct sunxi_pinctrl *pctl = dev_get_drvdata(chip->dev); |
522 | struct sunxi_desc_function *desc; | 522 | struct sunxi_desc_function *desc; |
523 | 523 | ||
524 | if (offset > chip->ngpio) | 524 | if (offset >= chip->ngpio) |
525 | return -ENXIO; | 525 | return -ENXIO; |
526 | 526 | ||
527 | desc = sunxi_pinctrl_desc_find_function_by_pin(pctl, offset, "irq"); | 527 | desc = sunxi_pinctrl_desc_find_function_by_pin(pctl, offset, "irq"); |