Skip to contentSkip to conversation

drm: remove redundant assignment to variable 'ret'

PATCH In review Jing Xiangfeng 2 participants 4 messages Jul 15, 2020 – Jul 16, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm: remove redundant assignment to variable 'ret'

The variable ret has been assigned the value '-EINVAL'. The assignment in the if() is redundant. We can remove it.

---
 drivers/gpu/drm/drm_auth.c | 1 -
 1 file changed, 1 deletion(-)
drivers/gpu/drm/drm_auth.c +0 -1
index 800ac39f3213..6e1b502f2797 100644
@@ -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;
 	}
 
Signature · 1 line
2.17.1
#1 lore raw
Quoted 2 lines · Jing Xiangfeng

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

Quoted 21 lines
---
 drivers/gpu/drm/drm_auth.c | 1 -
 1 file changed, 1 deletion(-)
drivers/gpu/drm/drm_auth.c +0 -1
index 800ac39f3213..6e1b502f2797 100644
@@ -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;
 	}
 
Signature · 1 line
2.17.1
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#2 lore raw
Quoted 6 lines · Daniel Vetter
Quoted 2 lines · Jing Xiangfeng

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

Quoted 24 lines

-Daniel

Quoted 21 lines
---
  drivers/gpu/drm/drm_auth.c | 1 -
  1 file changed, 1 deletion(-)
drivers/gpu/drm/drm_auth.c +0 -2
index 800ac39f3213..6e1b502f2797 100644
@@ -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

#3 lore raw
Quoted 7 lines · Jing Xiangfeng
Quoted 4 lines · Daniel Vetter
Quoted 2 lines · Jing Xiangfeng

The variable ret has been assigned the value '-EINVAL'. The assignment in the if() is redundant. We can remove it.

Quoted 6 lines
Quoted 2 lines

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 <[email protected]>
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

Quoted 30 lines

Thanks

Quoted 20 lines

-Daniel

Quoted 18 lines
---
  drivers/gpu/drm/drm_auth.c | 1 -
  1 file changed, 1 deletion(-)
drivers/gpu/drm/drm_auth.c +0 -1
index 800ac39f3213..6e1b502f2797 100644
@@ -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;
  	}
 
Quoted 4 lines
Quoted 3 lines

--
2.17.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel