2017-08-28 03:03:12

by Fenglin Wu

[permalink] [raw]
Subject: [PATCH V2] 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]>
Acked-by: Bjorn Andersson <[email protected]>
---
drivers/pinctrl/qcom/pinctrl-spmi-gpio.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c b/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c
index 664b641..8b77c04 100644
--- a/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c
+++ b/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c
@@ -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;
--
Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project.


2017-08-31 13:49:29

by Linus Walleij

[permalink] [raw]
Subject: Re: [PATCH V2] pinctrl: qcom: spmi-gpio: Correct power_source range check

On Mon, Aug 28, 2017 at 5:00 AM, <[email protected]> wrote:

> 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]>
> Acked-by: Bjorn Andersson <[email protected]>

I already applied a version of this.

Yours,
Linus Walleij