From: Benjamin Gaignard Date: Mon, 23 Oct 2017 15:55:36 +0000 (+0200) Subject: staging: ion: simplify ioctl args checking function X-Git-Tag: v5.15~10046^2~49 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fd1335936e85652817613e815cb234ae022c3e90;p=platform%2Fkernel%2Flinux-starfive.git staging: ion: simplify ioctl args checking function Make arguments checking more easy to read. Signed-off-by: Benjamin Gaignard Acked-by: Laura Abbott Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/android/ion/ion-ioctl.c b/drivers/staging/android/ion/ion-ioctl.c index d9f8b14..e26b786 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 */