Skip to contentSkip to conversation

drm/vmwgfx: Fix uninitialized return in vmw_cotable_unbind()

PATCH In review Christian Engelmayer 2 participants 2 messages Sep 18, 2015

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

PATCH 1/2 drm/vmwgfx: Fix uninitialized return in vmw_cotable_unbind()

Function vmw_cotable_unbind() uses the uninitialized variable ret as return value. Make the result deterministic and directly return as the variable is unused anyway. Detected by Coverity CID 1324256.

---
Compile tested only. Applies against linux-next.

---
 drivers/gpu/drm/vmwgfx/vmwgfx_cotable.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_cotable.c +1 -2
index ce659a125f2b..092ea81eeff7 100644
@@ -311,7 +311,6 @@ static int vmw_cotable_unbind(struct vmw_resource *res,
 	struct vmw_private *dev_priv = res->dev_priv;
 	struct ttm_buffer_object *bo = val_buf->bo;
 	struct vmw_fence_obj *fence;
-	int ret;
 
 	if (list_empty(&res->mob_head))
 		return 0;
@@ -328,7 +327,7 @@ static int vmw_cotable_unbind(struct vmw_resource *res,
 	if (likely(fence != NULL))
 		vmw_fence_obj_unreference(&fence);
 
-	return ret;
+	return 0;
 }
 
 /**
Signature · 1 line
1.9.1
Reviewed-by on v1 1/2
#1 lore raw

Good catch!

Quoted 35 lines · Christian Engelmayer

Function vmw_cotable_unbind() uses the uninitialized variable ret as return value. Make the result deterministic and directly return as the variable is unused anyway. Detected by Coverity CID 1324256.

---
Compile tested only. Applies against linux-next.

---
 drivers/gpu/drm/vmwgfx/vmwgfx_cotable.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_cotable.c +1 -2
index ce659a125f2b..092ea81eeff7 100644
@@ -311,7 +311,6 @@ static int vmw_cotable_unbind(struct vmw_resource *res,
 	struct vmw_private *dev_priv = res->dev_priv;
 	struct ttm_buffer_object *bo = val_buf->bo;
 	struct vmw_fence_obj *fence;
-	int ret;
 
 	if (list_empty(&res->mob_head))
 		return 0;
@@ -328,7 +327,7 @@ static int vmw_cotable_unbind(struct vmw_resource *res,
 	if (likely(fence != NULL))
 		vmw_fence_obj_unreference(&fence);
 
-	return ret;
+	return 0;
 }
 
 /**
Signature · 1 line
1.9.1

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