All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wei Yongjun <weiyj.lk@gmail.com>
To: Daniel Vetter <daniel.vetter@intel.com>,
	Jani Nikula <jani.nikula@linux.intel.com>,
	David Airlie <airlied@linux.ie>,
	Yulei Zhang <yulei.zhang@intel.com>,
	Zhenyu Wang <zhenyuw@linux.intel.com>,
	Zhi Wang <zhi.a.wang@intel.com>
Cc: Wei Yongjun <weiyongjun1@huawei.com>,
	intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH -next] drm/i915/gvt: fix return value check
Date: Wed, 19 Oct 2016 16:18:03 +0000	[thread overview]
Message-ID: <1476893883-8096-1-git-send-email-weiyj.lk@gmail.com> (raw)

From: Wei Yongjun <weiyongjun1@huawei.com>

In case of error, the function i915_gem_object_create() returns
ERR_PTR() not NULL. The NULL test in the return value check should
be replaced with IS_ERR().

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 drivers/gpu/drm/i915/gvt/cmd_parser.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/i915/gvt/cmd_parser.c b/drivers/gpu/drm/i915/gvt/cmd_parser.c
index 5808ee7..6abb2a6 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)

WARNING: multiple messages have this Message-ID (diff)
From: Wei Yongjun <weiyj.lk@gmail.com>
To: Daniel Vetter <daniel.vetter@intel.com>,
	Jani Nikula <jani.nikula@linux.intel.com>,
	David Airlie <airlied@linux.ie>,
	Yulei Zhang <yulei.zhang@intel.com>,
	Zhenyu Wang <zhenyuw@linux.intel.com>,
	Zhi Wang <zhi.a.wang@intel.com>
Cc: intel-gfx@lists.freedesktop.org,
	Wei Yongjun <weiyongjun1@huawei.com>,
	linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org
Subject: [PATCH -next] drm/i915/gvt: fix return value check
Date: Wed, 19 Oct 2016 16:18:03 +0000	[thread overview]
Message-ID: <1476893883-8096-1-git-send-email-weiyj.lk@gmail.com> (raw)

From: Wei Yongjun <weiyongjun1@huawei.com>

In case of error, the function i915_gem_object_create() returns
ERR_PTR() not NULL. The NULL test in the return value check should
be replaced with IS_ERR().

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 drivers/gpu/drm/i915/gvt/cmd_parser.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/i915/gvt/cmd_parser.c b/drivers/gpu/drm/i915/gvt/cmd_parser.c
index 5808ee7..6abb2a6 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@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

             reply	other threads:[~2016-10-19 16:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-19 16:18 Wei Yongjun [this message]
2016-10-19 16:18 ` [PATCH -next] drm/i915/gvt: fix return value check Wei Yongjun
2016-10-19 18:26 ` ✗ Fi.CI.BAT: warning for " Patchwork
2016-10-19 23:58 ` [PATCH -next] " Zhenyu Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1476893883-8096-1-git-send-email-weiyj.lk@gmail.com \
    --to=weiyj.lk@gmail.com \
    --cc=airlied@linux.ie \
    --cc=daniel.vetter@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=weiyongjun1@huawei.com \
    --cc=yulei.zhang@intel.com \
    --cc=zhenyuw@linux.intel.com \
    --cc=zhi.a.wang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.