Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752664AbdFTJdP (ORCPT ); Tue, 20 Jun 2017 05:33:15 -0400 Received: from mail-io0-f170.google.com ([209.85.223.170]:34831 "EHLO mail-io0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752440AbdFTJdG (ORCPT ); Tue, 20 Jun 2017 05:33:06 -0400 MIME-Version: 1.0 In-Reply-To: <20170613061707.13892-4-fenglinw@codeaurora.org> References: <20170613061707.13892-1-fenglinw@codeaurora.org> <20170613061707.13892-4-fenglinw@codeaurora.org> From: Linus Walleij Date: Tue, 20 Jun 2017 11:33:04 +0200 Message-ID: Subject: Re: [PATCH V1 3/3] pinctrl: qcom: spmi-gpio: Correct power_source range check To: fenglinw@codeaurora.org, Bjorn Andersson Cc: "linux-arm-msm@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Andy Gross , David Brown , "open list:ARM/QUALCOMM SUPPORT" , "linux-gpio@vger.kernel.org" , collinsd@quicinc.com, aghayal@qti.qualcomm.com, wruan@quicinc.com, kgunda@qti.qualcomm.com Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by mail.home.local id v5K9XUjf028599 Content-Length: 1172 Lines: 30 On Tue, Jun 13, 2017 at 8:16 AM, wrote: > From: Fenglin Wu > > 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 > --- > 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 581309d..1fd677c 100644 > --- a/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c > +++ b/drivers/pinctrl/qcom/pinctrl-spmi-gpio.c > @@ -500,7 +500,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; Björn can you ACK this? Yours, Linus Walleij