From 1739f5d37692f31f5b22f62238cb008d3d52475f Mon Sep 17 00:00:00 2001 From: Christophe JAILLET Date: Mon, 26 Sep 2016 22:24:46 +0200 Subject: [PATCH] spmi: pmic-arb: Return an error code if sanity check fails 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. Change-Id: I4f558ffb9cde0c9c1127202cd8b5d3ff11987c86 Signed-off-by: Christophe JAILLET Signed-off-by: Greg Kroah-Hartman Git-commit: e98cc182a06af3b8e91d6d719708db07045d78c4 Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git Signed-off-by: David Collins --- 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 f8ad13000f69..6c8154d126b2 100644 --- a/drivers/spmi/spmi-pmic-arb.c +++ b/drivers/spmi/spmi-pmic-arb.c @@ -1320,6 +1320,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; }