[patch] drm/i915/gvt: i915_gem_object_create() returns error pointers

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

 



The i915_gem_object_create() returns error pointers on error, it never
returns NULLs.

Fixes: ("drm/i915/gvt: vGPU command scanner")
Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
---
The error handling in perform_bb_shadow() is a bit leaky as well.

diff --git a/drivers/gpu/drm/i915/gvt/cmd_parser.c b/drivers/gpu/drm/i915/gvt/cmd_parser.c
index 5808ee7c1935..6abb2a679a3f 100644
--- a/drivers/gpu/drm/i915/gvt/cmd_parser.c
+++ b/drivers/gpu/drm/i915/gvt/cmd_parser.c
@@ -1640,8 +1640,8 @@ static int perform_bb_shadow(struct parser_exec_state *s)
 
 	entry_obj->obj = i915_gem_object_create(&(s->vgpu->gvt->dev_priv->drm),
 		round_up(bb_size, PAGE_SIZE));
-	if (entry_obj->obj == NULL)
-		return -ENOMEM;
+	if (IS_ERR(entry_obj->obj))
+		return PTR_ERR(entry_obj->obj);
 	entry_obj->len = bb_size;
 	INIT_LIST_HEAD(&entry_obj->list);
 
@@ -2712,8 +2712,8 @@ static int shadow_indirect_ctx(struct intel_shadow_wa_ctx *wa_ctx)
 
 	wa_ctx->indirect_ctx.obj = i915_gem_object_create(dev,
 			round_up(ctx_size + CACHELINE_BYTES, PAGE_SIZE));
-	if (wa_ctx->indirect_ctx.obj == NULL)
-		return -ENOMEM;
+	if (IS_ERR(wa_ctx->indirect_ctx.obj))
+		return PTR_ERR(wa_ctx->indirect_ctx.obj);
 
 	ret = i915_gem_object_get_pages(wa_ctx->indirect_ctx.obj);
 	if (ret)
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux