Skip to content

Commit

Permalink
qcom: ssbi-gpio: correct boundary conditions in pm8xxx_domain_translate
Browse files Browse the repository at this point in the history
SSBI GPIOs are numbered 1..ngpio, so the boundary check in
pm8xxx_domain_translate() is off by one. This patch corrects that check.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
  • Loading branch information
Brian Masney authored and Linus Walleij committed Feb 14, 2019
1 parent de744e0 commit 79890c2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/pinctrl/qcom/pinctrl-ssbi-gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,8 @@ static int pm8xxx_domain_translate(struct irq_domain *domain,
struct pm8xxx_gpio *pctrl = container_of(domain->host_data,
struct pm8xxx_gpio, chip);

if (fwspec->param_count != 2 || fwspec->param[0] >= pctrl->chip.ngpio)
if (fwspec->param_count != 2 || fwspec->param[0] < 1 ||
fwspec->param[0] > pctrl->chip.ngpio)
return -EINVAL;

*hwirq = fwspec->param[0] - PM8XXX_GPIO_PHYSICAL_OFFSET;
Expand Down

0 comments on commit 79890c2

Please sign in to comment.