Skip to content

Commit

Permalink
qcom: spmi-gpio: Fix boundary conditions IRQ domain translate
Browse files Browse the repository at this point in the history
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: ca69e2d ("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>
  • Loading branch information
Bjorn Andersson authored and Linus Walleij committed Feb 13, 2019
1 parent a44aec0 commit dac7da9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/pinctrl/qcom/pinctrl-spmi-gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit dac7da9

Please sign in to comment.