linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V1] pinctrl: qcom: spmi-gpio: Correct power_source range check
@ 2017-07-19  6:39 fenglinw
  2017-08-24  5:03 ` Bjorn Andersson
  2017-08-31 12:00 ` Linus Walleij
  0 siblings, 2 replies; 3+ messages in thread
From: fenglinw @ 2017-07-19  6:39 UTC (permalink / raw)
  To: linux-arm-msm, linux-kernel, bjorn.andersson, Linus Walleij,
	linux-gpio
  Cc: collinsd, aghayal, wruan, kgunda, Fenglin Wu

From: Fenglin Wu <fenglinw@codeaurora.org>

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>
---
 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.

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH V1] pinctrl: qcom: spmi-gpio: Correct power_source range check
  2017-07-19  6:39 [PATCH V1] pinctrl: qcom: spmi-gpio: Correct power_source range check fenglinw
@ 2017-08-24  5:03 ` Bjorn Andersson
  2017-08-31 12:00 ` Linus Walleij
  1 sibling, 0 replies; 3+ messages in thread
From: Bjorn Andersson @ 2017-08-24  5:03 UTC (permalink / raw)
  To: fenglinw
  Cc: linux-arm-msm, linux-kernel, Linus Walleij, linux-gpio, collinsd,
	aghayal, wruan, kgunda

On Tue 18 Jul 23:39 PDT 2017, fenglinw@codeaurora.org wrote:

> From: Fenglin Wu <fenglinw@codeaurora.org>
> 
> 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.
> 

Acked-by: Bjorn Andersson <bjorn.andersson@linaro.org>

Regards,
Bjorn

> Signed-off-by: Fenglin Wu <fenglinw@codeaurora.org>
> ---
>  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.
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH V1] pinctrl: qcom: spmi-gpio: Correct power_source range check
  2017-07-19  6:39 [PATCH V1] pinctrl: qcom: spmi-gpio: Correct power_source range check fenglinw
  2017-08-24  5:03 ` Bjorn Andersson
@ 2017-08-31 12:00 ` Linus Walleij
  1 sibling, 0 replies; 3+ messages in thread
From: Linus Walleij @ 2017-08-31 12:00 UTC (permalink / raw)
  To: fenglinw
  Cc: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org,
	Bjorn Andersson, linux-gpio@vger.kernel.org, David Collins,
	aghayal, wruan, kgunda

On Wed, Jul 19, 2017 at 8:39 AM,  <fenglinw@codeaurora.org> wrote:

> From: Fenglin Wu <fenglinw@codeaurora.org>
>
> 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>

Patch applied with Björn's ACK.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-08-31 12:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-19  6:39 [PATCH V1] pinctrl: qcom: spmi-gpio: Correct power_source range check fenglinw
2017-08-24  5:03 ` Bjorn Andersson
2017-08-31 12:00 ` Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).