diff options
author | Todd Poynor <toddpoynor@google.com> | 2018-07-21 06:34:55 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-07-24 13:56:45 +0200 |
commit | 996e650030857e791416af81d7d9171d9652bd9d (patch) | |
tree | e334f43b1a2d2627b2649887b30b8bf9e0ce261b /drivers/staging/gasket/gasket_ioctl.c | |
parent | 59ab5af731565762189d2f923887933fc1e84bcf (diff) |
staging: gasket: remove duplicate call to retrieve device callback
gasket_handle_ioctl() calls gasket_get_ioctl_permissions_cb() twice;
simplify the code and avoid duplicated work by fetching the callback
pointer only once.
Reported-by: Dmitry Torokhov <dtor@chromium.org>
Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/gasket/gasket_ioctl.c')
-rw-r--r-- | drivers/staging/gasket/gasket_ioctl.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/staging/gasket/gasket_ioctl.c b/drivers/staging/gasket/gasket_ioctl.c index 2e2c9b997093..dbe9fdef0c26 100644 --- a/drivers/staging/gasket/gasket_ioctl.c +++ b/drivers/staging/gasket/gasket_ioctl.c @@ -55,14 +55,15 @@ long gasket_handle_ioctl(struct file *filp, uint cmd, void __user *argp) { struct gasket_dev *gasket_dev; unsigned long arg = (unsigned long)argp; + gasket_ioctl_permissions_cb_t ioctl_permissions_cb; int retval; gasket_dev = (struct gasket_dev *)filp->private_data; trace_gasket_ioctl_entry(gasket_dev->dev_info.name, cmd); - if (gasket_get_ioctl_permissions_cb(gasket_dev)) { - retval = gasket_get_ioctl_permissions_cb(gasket_dev)( - filp, cmd, argp); + ioctl_permissions_cb = gasket_get_ioctl_permissions_cb(gasket_dev); + if (ioctl_permissions_cb) { + retval = ioctl_permissions_cb(filp, cmd, argp); if (retval < 0) { trace_gasket_ioctl_exit(-EPERM); return retval; |