Merge tag 'pinctrl-v5.1-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw...
[sfrench/cifs-2.6.git] / drivers / pinctrl / qcom / pinctrl-spmi-gpio.c
index df7d6f4ccf5d6bbc995797278bd3e028e524ac7f..76e57ae2f6e84b8b7cdf5b71965aab0be258d005 100644 (file)
@@ -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;