summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjorn Andersson <bjorn.andersson@linaro.org>2019-02-11 19:52:05 -0800
committerLinus Walleij <linus.walleij@linaro.org>2019-02-13 09:18:49 +0100
commitdac7da986ba39e9ff6b078ae15b561c4929edec1 (patch)
tree621fc7d83495ba80d0ba47a65fc7a8bfff909c93
parenta44aec0b4a63725c2601db4257d204a757198817 (diff)
downloadlinux-stable-dac7da986ba39e9ff6b078ae15b561c4929edec1.tar.gz
linux-stable-dac7da986ba39e9ff6b078ae15b561c4929edec1.tar.bz2
linux-stable-dac7da986ba39e9ff6b078ae15b561c4929edec1.zip
qcom: spmi-gpio: Fix boundary conditions IRQ domain translate
GPIOs on the SPMI PMIC are numbered 1..ngpio, so the boundary check in pmic_gpio_domain_translate() is off by one, correct this. Fixes: ca69e2d165eb ("qcom: spmi-gpio: add support for hierarchical IRQ chip") Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> Reviewed-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-rw-r--r--drivers/pinctrl/qcom/pinctrl-spmi-gpio.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c b/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c
index e01a556ac586..cb512c7a5251 100644
--- a/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c
+++ b/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c
@@ -962,7 +962,8 @@ static int pmic_gpio_domain_translate(struct irq_domain *domain,
struct pmic_gpio_state,
chip);
- if (fwspec->param_count != 2 || fwspec->param[0] >= state->chip.ngpio)
+ if (fwspec->param_count != 2 ||
+ fwspec->param[0] < 1 || fwspec->param[0] > state->chip.ngpio)
return -EINVAL;
*hwirq = fwspec->param[0] - PMIC_GPIO_PHYSICAL_OFFSET;