[PATCH] drm/vmwgfx: remove bogus NULL check

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
---
 drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
index d49de4905efa..8072c053be97 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
@@ -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);
 	}
-- 
2.20.1




[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux