[3/3] pinctrl: qcom-spmi-mpp: Fix input value report
diff mbox

Message ID 1428592717-21706-3-git-send-email-ivan.ivanov@linaro.org
State New
Headers show

Commit Message

Ivan T. Ivanov April 9, 2015, 3:18 p.m. UTC
Fix interpretation of the pmic_mpp_read() return code,
negative value means an error.

Signed-off-by: Ivan T. Ivanov <ivan.ivanov@linaro.org>
---
 drivers/pinctrl/qcom/pinctrl-spmi-mpp.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

--
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Bjorn Andersson April 9, 2015, 4:03 p.m. UTC | #1
On Thu 09 Apr 08:18 PDT 2015, Ivan T. Ivanov wrote:

> Fix interpretation of the pmic_mpp_read() return code,
> negative value means an error.
> 
> Signed-off-by: Ivan T. Ivanov <ivan.ivanov@linaro.org>
> ---
>  drivers/pinctrl/qcom/pinctrl-spmi-mpp.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/pinctrl/qcom/pinctrl-spmi-mpp.c b/drivers/pinctrl/qcom/pinctrl-spmi-mpp.c
> index 8f36c5f..8f6c7be 100644
> --- a/drivers/pinctrl/qcom/pinctrl-spmi-mpp.c
> +++ b/drivers/pinctrl/qcom/pinctrl-spmi-mpp.c
> @@ -576,10 +576,11 @@ static void pmic_mpp_config_dbg_show(struct pinctrl_dev *pctldev,
> 
>  		if (pad->input_enabled) {
>  			ret = pmic_mpp_read(state, pad, PMIC_MPP_REG_RT_STS);
> -			if (!ret) {
> -				ret &= PMIC_MPP_REG_RT_STS_VAL_MASK;
> -				pad->out_value = ret;
> -			}
> +			if (ret < 0)
> +				return;
> +
> +			ret &= PMIC_MPP_REG_RT_STS_VAL_MASK;
> +			pad->out_value = ret;

Same as with the gpio driver.

Reviewed-by: Bjorn Andersson <bjorn.andersson@sonymobile.com>

Regards,
Bjrn
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Linus Walleij April 28, 2015, 12:53 p.m. UTC | #2
On Thu, Apr 9, 2015 at 5:18 PM, Ivan T. Ivanov <ivan.ivanov@linaro.org> wrote:

> Fix interpretation of the pmic_mpp_read() return code,
> negative value means an error.
>
> Signed-off-by: Ivan T. Ivanov <ivan.ivanov@linaro.org>

Patch applied for fixes.

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch
diff mbox

diff --git a/drivers/pinctrl/qcom/pinctrl-spmi-mpp.c b/drivers/pinctrl/qcom/pinctrl-spmi-mpp.c
index 8f36c5f..8f6c7be 100644
--- a/drivers/pinctrl/qcom/pinctrl-spmi-mpp.c
+++ b/drivers/pinctrl/qcom/pinctrl-spmi-mpp.c
@@ -576,10 +576,11 @@  static void pmic_mpp_config_dbg_show(struct pinctrl_dev *pctldev,

 		if (pad->input_enabled) {
 			ret = pmic_mpp_read(state, pad, PMIC_MPP_REG_RT_STS);
-			if (!ret) {
-				ret &= PMIC_MPP_REG_RT_STS_VAL_MASK;
-				pad->out_value = ret;
-			}
+			if (ret < 0)
+				return;
+
+			ret &= PMIC_MPP_REG_RT_STS_VAL_MASK;
+			pad->out_value = ret;
 		}

 		seq_printf(s, " %-4s", pad->output_enabled ? "out" : "in");