Commit e98cc182a06af3b8e91d6d719708db07045d78c4

Authored by Christophe JAILLET
Committed by Greg Kroah-Hartman
1 parent e7fca5d860

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.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Showing 1 changed file with 1 additions and 0 deletions Side-by-side Diff

drivers/spmi/spmi-pmic-arb.c
... ... @@ -954,6 +954,7 @@
954 954 if (channel > 5) {
955 955 dev_err(&pdev->dev, "invalid channel (%u) specified.\n",
956 956 channel);
  957 + err = -EINVAL;
957 958 goto err_put_ctrl;
958 959 }
959 960