From: Sam Ravnborg <sam@ravnborg.org>
To: Emil Velikov <emil.l.velikov@gmail.com>
Cc: David Airlie <airlied@linux.ie>,
Colin Ian King <colin.king@canonical.com>,
dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v2 2/2] drm/auth: make drm_{set,drop]master_ioctl symmetrical
Date: Sat, 30 May 2020 15:18:15 +0200 [thread overview]
Message-ID: <20200530131815.GA82487@ravnborg.org> (raw)
In-Reply-To: <20200530124640.4176323-2-emil.l.velikov@gmail.com>
Hi Emil.
On Sat, May 30, 2020 at 01:46:40PM +0100, Emil Velikov wrote:
> 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
Now even I should be able to follow the flow - thanks :-)
>
> 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>
> ---
> Colin, pretty sure that this should address couple of Coverity warnings.
> Yet I didn't check their web UI thingy.
> ---
> drivers/gpu/drm/drm_auth.c | 12 +++++++-----
> 1 file 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);
> --
> 2.25.1
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2020-05-30 13:18 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-30 12:46 [PATCH v2 1/2] drm: vmwgfx: remove drm_driver::master_set() return typ Emil Velikov
2020-05-30 12:46 ` [PATCH v2 2/2] drm/auth: make drm_{set,drop]master_ioctl symmetrical Emil Velikov
2020-05-30 13:18 ` Sam Ravnborg [this message]
2020-05-30 13:34 ` [PATCH v2 2/2] drm/auth: make drm_{set, drop]master_ioctl symmetrical Emil Velikov
2020-05-30 13:43 ` [PATCH v2 2/2] drm/auth: make drm_{set,drop]master_ioctl symmetrical Sam Ravnborg
2020-06-03 18:37 ` [PATCH v2 1/2] drm: vmwgfx: remove drm_driver::master_set() return typ Roland Scheidegger
2020-06-05 14:07 ` Emil Velikov
2020-06-15 19:22 ` Emil Velikov
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=20200530131815.GA82487@ravnborg.org \
--to=sam@ravnborg.org \
--cc=airlied@linux.ie \
--cc=colin.king@canonical.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=emil.l.velikov@gmail.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.