aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmil Velikov <[email protected]>2020-05-30 13:46:40 +0100
committerEmil Velikov <[email protected]>2020-06-15 14:49:50 +0100
commit264ddd077c72092178153fc32d510dcecff32eeb (patch)
tree239802070d84bc7d70c8cc15f9fff2524831bfc0
parent907f53200f982cd377e75abbc1b18ed624d7ae66 (diff)
drm/auth: make drm_{set,drop}master_ioctl symmetrical
Currently the ret handling is all over the place - with two redundant assignments and another one addressed earlier. Use the exact same flow in both functions. v2: straighten the code flow, instead of just removing the assignments Cc: David Airlie <[email protected]> Cc: Daniel Vetter <[email protected]> Cc: Sam Ravnborg <[email protected]> Cc: Colin Ian King <[email protected]> Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Sam Ravnborg <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
-rw-r--r--drivers/gpu/drm/drm_auth.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/gpu/drm/drm_auth.c b/drivers/gpu/drm/drm_auth.c
index 4c723e3a689c..f2d46b7ac6f9 100644
--- a/drivers/gpu/drm/drm_auth.c
+++ b/drivers/gpu/drm/drm_auth.c
@@ -215,7 +215,7 @@ drm_master_check_perm(struct drm_device *dev, struct drm_file *file_priv)
int drm_setmaster_ioctl(struct drm_device *dev, void *data,
struct drm_file *file_priv)
{
- int ret = 0;
+ int ret;
mutex_lock(&dev->master_mutex);
@@ -272,12 +272,15 @@ int drm_dropmaster_ioctl(struct drm_device *dev, void *data,
if (ret)
goto out_unlock;
- ret = -EINVAL;
- if (!drm_is_current_master(file_priv))
+ if (!drm_is_current_master(file_priv)) {
+ ret = -EINVAL;
goto out_unlock;
+ }
- if (!dev->master)
+ if (!dev->master) {
+ ret = -EINVAL;
goto out_unlock;
+ }
if (file_priv->master->lessor != NULL) {
DRM_DEBUG_LEASE("Attempt to drop lessee %d as master\n", file_priv->master->lessee_id);
@@ -285,7 +288,6 @@ int drm_dropmaster_ioctl(struct drm_device *dev, void *data,
goto out_unlock;
}
- ret = 0;
drm_drop_master(dev, file_priv);
out_unlock:
mutex_unlock(&dev->master_mutex);