1
0
Fork 0

qcom: ssbi-gpio: correct boundary conditions in pm8xxx_domain_translate

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>
hifive-unleashed-5.1
Brian Masney 2019-02-13 20:36:41 -05:00 committed by Linus Walleij
parent de744e01aa
commit 79890c2ec4
1 changed files with 2 additions and 1 deletions

View File

@ -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;