From: Benjamin Gaignard <benjamin.gaignard@linaro.org>
To: labbott@redhat.com, sumit.semwal@linaro.org,
gregkh@linuxfoundation.org, arve@android.com,
riandrews@android.com, broonie@kernel.org,
dan.carpenter@oracle.com
Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org,
dri-devel@lists.freedesktop.org,
Benjamin Gaignard <benjamin.gaignard@linaro.org>
Subject: [PATCH v3 1/2] staging: ion: simplify ioctl args checking function
Date: Wed, 20 Sep 2017 10:45:04 +0200 [thread overview]
Message-ID: <1505897105-23721-2-git-send-email-benjamin.gaignard@linaro.org> (raw)
In-Reply-To: <1505897105-23721-1-git-send-email-benjamin.gaignard@linaro.org>
Make arguments checking more easy to read.
Signed-off-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
---
drivers/staging/android/ion/ion-ioctl.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
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 */
--
2.7.4
next prev parent reply other threads:[~2017-09-20 8:45 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-20 8:45 [PATCH v3 0/2] staging: ion: get one device per heap Benjamin Gaignard
2017-09-20 8:45 ` Benjamin Gaignard [this message]
2017-09-20 8:45 ` [PATCH v3 2/2] staging: ion: create one device entry " Benjamin Gaignard
2017-09-25 18:26 ` Laura Abbott
2017-09-26 5:09 ` Daniel Vetter
2017-09-26 6:56 ` Greg KH
2017-09-26 17:52 ` Laura Abbott
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1505897105-23721-2-git-send-email-benjamin.gaignard@linaro.org \
--to=benjamin.gaignard@linaro.org \
--cc=arve@android.com \
--cc=broonie@kernel.org \
--cc=dan.carpenter@oracle.com \
--cc=devel@driverdev.osuosl.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=gregkh@linuxfoundation.org \
--cc=labbott@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=riandrews@android.com \
--cc=sumit.semwal@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®