* [PATCH] drm: remove redundant assignment to variable 'ret'
@ 2020-07-15 7:05 Jing Xiangfeng
2020-07-15 12:05 ` Daniel Vetter
0 siblings, 1 reply; 4+ messages in thread
From: Jing Xiangfeng @ 2020-07-15 7:05 UTC (permalink / raw)
To: maarten.lankhorst, mripard, tzimmermann, airlied, daniel, ajax
Cc: dri-devel, linux-kernel, jingxiangfeng
The variable ret has been assigned the value '-EINVAL'. The assignment
in the if() is redundant. We can remove it.
Signed-off-by: Jing Xiangfeng <jingxiangfeng@huawei.com>
---
drivers/gpu/drm/drm_auth.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/gpu/drm/drm_auth.c b/drivers/gpu/drm/drm_auth.c
index 800ac39f3213..6e1b502f2797 100644
--- a/drivers/gpu/drm/drm_auth.c
+++ b/drivers/gpu/drm/drm_auth.c
@@ -299,7 +299,6 @@ int drm_dropmaster_ioctl(struct drm_device *dev, void *data,
if (file_priv->master->lessor != NULL) {
DRM_DEBUG_LEASE("Attempt to drop lessee %d as master\n", file_priv->master->lessee_id);
- ret = -EINVAL;
goto out_unlock;
}
--
2.17.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] drm: remove redundant assignment to variable 'ret'
2020-07-15 7:05 [PATCH] drm: remove redundant assignment to variable 'ret' Jing Xiangfeng
@ 2020-07-15 12:05 ` Daniel Vetter
2020-07-16 1:59 ` Jing Xiangfeng
0 siblings, 1 reply; 4+ messages in thread
From: Daniel Vetter @ 2020-07-15 12:05 UTC (permalink / raw)
To: Jing Xiangfeng
Cc: maarten.lankhorst, mripard, tzimmermann, airlied, daniel, ajax,
dri-devel, linux-kernel
On Wed, Jul 15, 2020 at 03:05:59PM +0800, Jing Xiangfeng wrote:
> The variable ret has been assigned the value '-EINVAL'. The assignment
> in the if() is redundant. We can remove it.
Nope, that's not correct. Before this assignement ret is guaranteed to be
0.
-Daniel
>
> Signed-off-by: Jing Xiangfeng <jingxiangfeng@huawei.com>
> ---
> drivers/gpu/drm/drm_auth.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/drm_auth.c b/drivers/gpu/drm/drm_auth.c
> index 800ac39f3213..6e1b502f2797 100644
> --- a/drivers/gpu/drm/drm_auth.c
> +++ b/drivers/gpu/drm/drm_auth.c
> @@ -299,7 +299,6 @@ int drm_dropmaster_ioctl(struct drm_device *dev, void *data,
>
> if (file_priv->master->lessor != NULL) {
> DRM_DEBUG_LEASE("Attempt to drop lessee %d as master\n", file_priv->master->lessee_id);
> - ret = -EINVAL;
> goto out_unlock;
> }
>
> --
> 2.17.1
>
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] drm: remove redundant assignment to variable 'ret'
2020-07-15 12:05 ` Daniel Vetter
@ 2020-07-16 1:59 ` Jing Xiangfeng
2020-07-16 10:02 ` Daniel Vetter
0 siblings, 1 reply; 4+ messages in thread
From: Jing Xiangfeng @ 2020-07-16 1:59 UTC (permalink / raw)
To: maarten.lankhorst, mripard, tzimmermann, airlied, ajax,
dri-devel, linux-kernel
On 2020/7/15 20:05, Daniel Vetter wrote:
> On Wed, Jul 15, 2020 at 03:05:59PM +0800, Jing Xiangfeng wrote:
>> The variable ret has been assigned the value '-EINVAL'. The assignment
>> in the if() is redundant. We can remove it.
>
> Nope, that's not correct. Before this assignement ret is guaranteed to be
> 0.
Before this assignment ret is '-EINVAL'(see commit 45bc3d26c95a: "drm:
rework SET_MASTER and DROP_MASTER perm handling"). It is set to 0 above
around the drm_drop_master() calls.
Thanks
> -Daniel
>
>>
>> Signed-off-by: Jing Xiangfeng <jingxiangfeng@huawei.com>
>> ---
>> drivers/gpu/drm/drm_auth.c | 1 -
>> 1 file changed, 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/drm_auth.c b/drivers/gpu/drm/drm_auth.c
>> index 800ac39f3213..6e1b502f2797 100644
>> --- a/drivers/gpu/drm/drm_auth.c
>> +++ b/drivers/gpu/drm/drm_auth.c
>> @@ -299,7 +299,6 @@ int drm_dropmaster_ioctl(struct drm_device *dev, void *data,
>>
>> if (file_priv->master->lessor != NULL) {
>> DRM_DEBUG_LEASE("Attempt to drop lessee %d as master\n", file_priv->master->lessee_id);
>> - ret = -EINVAL;
>> goto out_unlock;
>> }
>>
>> --
>> 2.17.1
>>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] drm: remove redundant assignment to variable 'ret'
2020-07-16 1:59 ` Jing Xiangfeng
@ 2020-07-16 10:02 ` Daniel Vetter
0 siblings, 0 replies; 4+ messages in thread
From: Daniel Vetter @ 2020-07-16 10:02 UTC (permalink / raw)
To: Jing Xiangfeng
Cc: maarten.lankhorst, mripard, tzimmermann, airlied, ajax,
dri-devel, linux-kernel
On Thu, Jul 16, 2020 at 09:59:38AM +0800, Jing Xiangfeng wrote:
>
>
> On 2020/7/15 20:05, Daniel Vetter wrote:
> > On Wed, Jul 15, 2020 at 03:05:59PM +0800, Jing Xiangfeng wrote:
> > > The variable ret has been assigned the value '-EINVAL'. The assignment
> > > in the if() is redundant. We can remove it.
> >
> > Nope, that's not correct. Before this assignement ret is guaranteed to be
> > 0.
>
> Before this assignment ret is '-EINVAL'(see commit 45bc3d26c95a: "drm:
> rework SET_MASTER and DROP_MASTER perm handling"). It is set to 0 above
> around the drm_drop_master() calls.
Ah indeed, but it got fixed already in
commit 264ddd077c72092178153fc32d510dcecff32eeb
Author: Emil Velikov <emil.l.velikov@gmail.com>
Date: Sat May 30 13:46:40 2020 +0100
drm/auth: make drm_{set,drop}master_ioctl symmetrical
That's why your patch didn't make any sense to me.
-Daniel
>
> Thanks
> > -Daniel
> >
> > >
> > > Signed-off-by: Jing Xiangfeng <jingxiangfeng@huawei.com>
> > > ---
> > > drivers/gpu/drm/drm_auth.c | 1 -
> > > 1 file changed, 1 deletion(-)
> > >
> > > diff --git a/drivers/gpu/drm/drm_auth.c b/drivers/gpu/drm/drm_auth.c
> > > index 800ac39f3213..6e1b502f2797 100644
> > > --- a/drivers/gpu/drm/drm_auth.c
> > > +++ b/drivers/gpu/drm/drm_auth.c
> > > @@ -299,7 +299,6 @@ int drm_dropmaster_ioctl(struct drm_device *dev, void *data,
> > >
> > > if (file_priv->master->lessor != NULL) {
> > > DRM_DEBUG_LEASE("Attempt to drop lessee %d as master\n", file_priv->master->lessee_id);
> > > - ret = -EINVAL;
> > > goto out_unlock;
> > > }
> > >
> > > --
> > > 2.17.1
> > >
> >
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-07-16 10:02 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-15 7:05 [PATCH] drm: remove redundant assignment to variable 'ret' Jing Xiangfeng
2020-07-15 12:05 ` Daniel Vetter
2020-07-16 1:59 ` Jing Xiangfeng
2020-07-16 10:02 ` Daniel Vetter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).