Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit dac7da98 authored by Bjorn Andersson's avatar Bjorn Andersson Committed by Linus Walleij
Browse files

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: ca69e2d1 ("qcom: spmi-gpio: add support for hierarchical IRQ chip")
Signed-off-by: default avatarBjorn Andersson <bjorn.andersson@linaro.org>
Reviewed-by: default avatarBrian Masney <masneyb@onstation.org>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent a44aec0b
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -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;