Skip to contentSkip to conversation

drm/vmwgfx: remove bogus NULL check

PATCH New Dan Carpenter 1 participant 1 message Apr 12, 2022

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

PATCH 1/1 drm/vmwgfx: remove bogus NULL check

The IS_ERR_OR_NULL() check in vmw_translate_mob_ptr() should just be an IS_ERR() check.

The NULL check is confusing because vmw_user_bo_noref_lookup() can never return NULL. A NULL return here would only lead to bugs and crashing. For example, Smatch complains that it would lead to an uninitialized variable in the caller.

drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c:1314 vmw_cmd_dx_bind_query()
error: uninitialized symbol 'vmw_bo'.

So clean this code up and silence then static checker warnings by removing the bogus NULL check.

---
 drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c +1 -1
index d49de4905efa..8072c053be97 100644
@@ -1172,7 +1172,7 @@ static int vmw_translate_mob_ptr(struct vmw_private *dev_priv,
 
 	vmw_validation_preload_bo(sw_context->ctx);
 	vmw_bo = vmw_user_bo_noref_lookup(sw_context->filp, handle);
-	if (IS_ERR_OR_NULL(vmw_bo)) {
+	if (IS_ERR(vmw_bo)) {
 		VMW_DEBUG_USER("Could not find or use MOB buffer.\n");
 		return PTR_ERR(vmw_bo);
 	}
Signature · 1 line
2.20.1