public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Mika Kuoppala <mika.kuoppala@linux.intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: dan.carpenter@oracle.com
Subject: [PATCH] drm/i915/selftests: Fix an IS_ERR() vs NULL check
Date: Wed, 27 Mar 2019 11:32:14 +0200	[thread overview]
Message-ID: <20190327093214.19813-1-mika.kuoppala@linux.intel.com> (raw)
In-Reply-To: <155367870306.24691.4294858872846465879@skylake-alporthouse-com>

The live_context() function returns error pointers.  It never returns
NULL.

v2: don't clamp the err (Chris)

Fixes: 52c0fdb25c7c ("drm/i915: Replace global breadcrumbs with per-context interrupt tracking")
Signed-off-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
---
 drivers/gpu/drm/i915/selftests/i915_request.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i915/selftests/i915_request.c b/drivers/gpu/drm/i915/selftests/i915_request.c
index e6ffe2240126..b0409353c5a4 100644
--- a/drivers/gpu/drm/i915/selftests/i915_request.c
+++ b/drivers/gpu/drm/i915/selftests/i915_request.c
@@ -1146,11 +1146,15 @@ static int live_breadcrumbs_smoketest(void *arg)
 
 	mutex_lock(&i915->drm.struct_mutex);
 	for (n = 0; n < t[0].ncontexts; n++) {
-		t[0].contexts[n] = live_context(i915, file);
-		if (!t[0].contexts[n]) {
-			ret = -ENOMEM;
+		struct i915_gem_context *ctx;
+
+		ctx = live_context(i915, file);
+		if (IS_ERR(ctx)) {
+			ret = PTR_ERR(ctx);
 			goto out_contexts;
 		}
+
+		t[0].contexts[n] = ctx;
 	}
 
 	ret = igt_live_test_begin(&live, i915, __func__, "");
-- 
2.17.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2019-03-27  9:32 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-27  9:20 [PATCH] drm/i915/selftests: Fix an IS_ERR() vs NULL check Mika Kuoppala
2019-03-27  9:25 ` Chris Wilson
2019-03-27  9:32   ` Mika Kuoppala [this message]
2019-03-27  9:52     ` Chris Wilson
2019-03-27 13:24 ` ✗ Fi.CI.BAT: failure for drm/i915/selftests: Fix an IS_ERR() vs NULL check (rev3) Patchwork
2019-03-28 11:56   ` Mika Kuoppala
  -- strict thread matches above, loose matches on Subject: below --
2019-03-26  5:08 [PATCH] drm/i915/selftests: Fix an IS_ERR() vs NULL check Dan Carpenter
2019-03-26  9:30 ` Mika Kuoppala
2019-03-26 14:53   ` Chris Wilson
2019-03-26 15:35     ` Dan Carpenter

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=20190327093214.19813-1-mika.kuoppala@linux.intel.com \
    --to=mika.kuoppala@linux.intel.com \
    --cc=dan.carpenter@oracle.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox