spmi: pmic-arb: Return an error code if sanity check fails
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Mon, 26 Sep 2016 20:24:46 +0000 (22:24 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 27 Sep 2016 10:43:34 +0000 (12:43 +0200)
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/spmi/spmi-pmic-arb.c

index aca282d..5ec3a59 100644 (file)
@@ -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;
        }