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 <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200530124640.4176323-2-emil.l.velikov@gmail.com
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);
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);
goto out_unlock;
}
- ret = 0;
drm_drop_master(dev, file_priv);
out_unlock:
mutex_unlock(&dev->master_mutex);