Commit fd133593 authored by Benjamin Gaignard's avatar Benjamin Gaignard Committed by Greg Kroah-Hartman

staging: ion: simplify ioctl args checking function

Make arguments checking more easy to read.
Signed-off-by: default avatarBenjamin Gaignard <benjamin.gaignard@linaro.org>
Acked-by: default avatarLaura Abbott <labbott@redhat.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 198277f2
......@@ -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 */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment