pinctrl: qcom: spmi-gpio: Correct power_source range check
Subsystems (5)
PATCH 1/1 pinctrl: qcom: spmi-gpio: Correct power_source range check
From: Fenglin Wu <[email protected]>
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 <[email protected]>
--- drivers/pinctrl/qcom/pinctrl-spmi-gpio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/qcom/pinctrl-spmi-gpio.c +1 -1
@@ -375,7 +375,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 ;
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.
Quoted 5 lines · On Tue 18 Jul 23:39 PDT 2017, [email protected] wrote:
From: Fenglin Wu <[email protected]>
Power source selection in
DIG_VIN_CTLis indexed from 0, in the range check it shouldn't be equal to the total number of power sources.
Acked-by Bjorn Andersson <[email protected]>
Regards,
Bjorn
Quoted 22 lines
Signed-off-by Fenglin Wu <[email protected]>--- drivers/pinctrl/qcom/pinctrl-spmi-gpio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/pinctrl/qcom/pinctrl-spmi-gpio.c +1
-1@@ -375,7 +375,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 ;Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.
Quoted 6 lines · On Wed, Jul 19, 2017 at 8:39 AM, <[email protected]> wrote:
From: Fenglin Wu <[email protected]>
Power source selection in
DIG_VIN_CTLis indexed from 0, in the range check it shouldn't be equal to the total number of power sources.Signed-off-by Fenglin Wu <[email protected]>
Patch applied with Björn's ACK.
Yours,
Linus Walleij