pinctrl: qcom: spmi-gpio: Correct power_source range check
authorFenglin Wu <fenglinw@codeaurora.org>
Wed, 19 Jul 2017 06:39:55 +0000 (14:39 +0800)
committerLinus Walleij <linus.walleij@linaro.org>
Thu, 31 Aug 2017 11:59:15 +0000 (13:59 +0200)
Power source selection in DIG_VIN_CTL is indexed from 0, in the range
check it shouldn't be equal to the total number of power sources.

Signed-off-by: Fenglin Wu <fenglinw@codeaurora.org>
Acked-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/pinctrl/qcom/pinctrl-spmi-gpio.c

index 73ce2b5cf9a3840ca9703cc58078ad14d833b3a3..c2c0bab04257dfdd3d5d118d043f7928b94be3dc 100644 (file)
@@ -487,7 +487,7 @@ static int pmic_gpio_config_set(struct pinctrl_dev *pctldev, unsigned int pin,
                        pad->is_enabled = false;
                        break;
                case PIN_CONFIG_POWER_SOURCE:
-                       if (arg > pad->num_sources)
+                       if (arg >= pad->num_sources)
                                return -EINVAL;
                        pad->power_source = arg;
                        break;