drm/gem: Remove unneeded ret check in change handle ioctl
Subsystems (2)
PATCH 1/1 drm/gem: Remove unneeded ret check in change handle ioctl
Remove the "if (ret < 0)" branch after idr_replace in drm_gem_change_handle_ioctl. It is unused, as in the only place we modify the return value between there and the previous return value check, we also immediately jump to out_unlock, bypassing the check entirely.
Issue caught by static analysis.
--- drivers/gpu/drm/drm_gem.c | 3 --- 1 file changed, 3 deletions(-)
drivers/gpu/drm/drm_gem.c +0 -3
@@ -1067,9 +1067,6 @@ int drm_gem_change_handle_ioctl(struct drm_device *dev, void *data,spin_unlock (&file_priv->table_lock); -if (ret <0 ) - goto out_unlock; -if (obj->dma_buf) { ret =drm_prime_add_buf_handle (&file_priv->prime, obj->dma_buf, handle);
Signature · 1 line
2.53.0
Quoted 7 lines · Jonathan Cavitt
Remove the "if (ret < 0)" branch after
idr_replaceindrm_gem_change_handle_ioctl. It is unused, as in the only place we modify the return value between there and the previous return value check, we also immediately jump toout_unlock, bypassing the check entirely.Issue caught by static analysis.
Quoted 28 lines
Signed-off-by Jonathan Cavitt <[email protected]>Cc Maarten Lankhorst <[email protected]>Cc Maxime Ripard <[email protected]>Cc Thomas Zimmermann <[email protected]>Cc David Airlie <[email protected]>Cc Simona Vetter <[email protected]>--- drivers/gpu/drm/drm_gem.c | 3 --- 1 file changed, 3 deletions(-)drivers/gpu/drm/drm_gem.c +0
-3@@ -1067,9 +1067,6 @@ int drm_gem_change_handle_ioctl(struct drm_device *dev, void *data,spin_unlock (&file_priv->table_lock); -if (ret <0 ) - goto out_unlock; -if (obj->dma_buf) { ret =drm_prime_add_buf_handle (&file_priv->prime, obj->dma_buf, handle);Signature · 1 line
2.53.0
Quoted 10 lines · Rodrigo Vivi
Quoted 7 lines · Jonathan Cavitt
Remove the "if (ret < 0)" branch after
idr_replaceindrm_gem_change_handle_ioctl. It is unused, as in the only place we modify the return value between there and the previous return value check, we also immediately jump toout_unlock, bypassing the check entirely.Issue caught by static analysis.
Reviewed-by Rodrigo Vivi <[email protected]>
It doesn't apply in drm-misc branches yet because it doesn't yet have the culprit patch that caused this code.
That is only part of drm-fixes:
5e28b7b94408 ("drm: Set old handle to NULL before prime swap in change_handle")
I believe this patch here can wait this culprit patch to get propagated through a backmerge/rebase...
Quoted 29 lines
Quoted 29 lines
Signed-off-by Jonathan Cavitt <[email protected]>Cc Maarten Lankhorst <[email protected]>Cc Maxime Ripard <[email protected]>Cc Thomas Zimmermann <[email protected]>Cc David Airlie <[email protected]>Cc Simona Vetter <[email protected]>--- drivers/gpu/drm/drm_gem.c | 3 --- 1 file changed, 3 deletions(-)drivers/gpu/drm/drm_gem.c +0
-3@@ -1067,9 +1067,6 @@ int drm_gem_change_handle_ioctl(struct drm_device *dev, void *data,spin_unlock (&file_priv->table_lock); -if (ret <0 ) - goto out_unlock; -if (obj->dma_buf) { ret =drm_prime_add_buf_handle (&file_priv->prime, obj->dma_buf, handle);Signature · 1 line
2.53.0