public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] spmi: pmic-arb: Return an error code if sanity check fails
@ 2016-09-26 20:24 Christophe JAILLET
  2016-09-27 22:15 ` Stephen Boyd
  0 siblings, 1 reply; 2+ messages in thread
From: Christophe JAILLET @ 2016-09-26 20:24 UTC (permalink / raw)
  To: sboyd, gregkh, bjorn.andersson, marc.zyngier
  Cc: linux-kernel, kernel-janitors, Christophe JAILLET

If the test 'if (channel > 5)' is true, then we will return 'err' which
is known to be 0 at this point.
Return -EINVAL instead.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
Un-tested
---
 drivers/spmi/spmi-pmic-arb.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/spmi/spmi-pmic-arb.c b/drivers/spmi/spmi-pmic-arb.c
index aca282d45421..5ec3a595dc7d 100644
--- a/drivers/spmi/spmi-pmic-arb.c
+++ b/drivers/spmi/spmi-pmic-arb.c
@@ -954,6 +954,7 @@ static int spmi_pmic_arb_probe(struct platform_device *pdev)
 	if (channel > 5) {
 		dev_err(&pdev->dev, "invalid channel (%u) specified.\n",
 			channel);
+		err = -EINVAL;
 		goto err_put_ctrl;
 	}
 
-- 
2.7.4

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

* Re: [PATCH] spmi: pmic-arb: Return an error code if sanity check fails
  2016-09-26 20:24 [PATCH] spmi: pmic-arb: Return an error code if sanity check fails Christophe JAILLET
@ 2016-09-27 22:15 ` Stephen Boyd
  0 siblings, 0 replies; 2+ messages in thread
From: Stephen Boyd @ 2016-09-27 22:15 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: gregkh, bjorn.andersson, marc.zyngier, linux-kernel,
	kernel-janitors

On 09/26, Christophe JAILLET wrote:
> If the test 'if (channel > 5)' is true, then we will return 'err' which
> is known to be 0 at this point.
> Return -EINVAL instead.
> 
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---

Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>

Looks right, thanks.

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

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

end of thread, other threads:[~2016-09-27 22:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-26 20:24 [PATCH] spmi: pmic-arb: Return an error code if sanity check fails Christophe JAILLET
2016-09-27 22:15 ` Stephen Boyd

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox