summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Masney <masneyb@onstation.org>2019-02-13 20:36:41 -0500
committerLinus Walleij <linus.walleij@linaro.org>2019-02-14 10:03:04 +0100
commit79890c2ec4860c3b715f89248c51abcc76a1fa39 (patch)
treed90d8d1e9198ba847a0415253cf7a5071f782d4b
parentde744e01aa3af421470eb9725574e3cbce319053 (diff)
downloadlinux-79890c2ec4860c3b715f89248c51abcc76a1fa39.tar.bz2
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>
-rw-r--r--drivers/pinctrl/qcom/pinctrl-ssbi-gpio.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/pinctrl/qcom/pinctrl-ssbi-gpio.c b/drivers/pinctrl/qcom/pinctrl-ssbi-gpio.c
index 84a232450000..08dd62b5cebe 100644
--- a/drivers/pinctrl/qcom/pinctrl-ssbi-gpio.c
+++ b/drivers/pinctrl/qcom/pinctrl-ssbi-gpio.c
@@ -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;