diff options
author | Benjamin Gaignard <benjamin.gaignard@linaro.org> | 2017-10-23 17:55:36 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-11-02 11:44:46 +0100 |
commit | fd1335936e85652817613e815cb234ae022c3e90 (patch) | |
tree | ca42578f9e704d25ad72c987eb027ca6ab539bba /drivers/staging/android | |
parent | 198277f29dcfa98328a8a429725edab3d92b65be (diff) | |
download | blackbird-obmc-linux-fd1335936e85652817613e815cb234ae022c3e90.tar.gz blackbird-obmc-linux-fd1335936e85652817613e815cb234ae022c3e90.zip |
staging: ion: simplify ioctl args checking function
Make arguments checking more easy to read.
Signed-off-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
Acked-by: Laura Abbott <labbott@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/android')
-rw-r--r-- | drivers/staging/android/ion/ion-ioctl.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/staging/android/ion/ion-ioctl.c b/drivers/staging/android/ion/ion-ioctl.c index d9f8b1424da1..e26b7864db16 100644 --- a/drivers/staging/android/ion/ion-ioctl.c +++ b/drivers/staging/android/ion/ion-ioctl.c @@ -27,19 +27,18 @@ union ion_ioctl_arg { static int validate_ioctl_arg(unsigned int cmd, union ion_ioctl_arg *arg) { - int ret = 0; - switch (cmd) { case ION_IOC_HEAP_QUERY: - ret = arg->query.reserved0 != 0; - ret |= arg->query.reserved1 != 0; - ret |= arg->query.reserved2 != 0; + if (arg->query.reserved0 || + arg->query.reserved1 || + arg->query.reserved2 ) + return -EINVAL; break; default: break; } - return ret ? -EINVAL : 0; + return 0; } /* fix up the cases where the ioctl direction bits are incorrect */ |