[Intel-gfx] [PATCH] drm/i915/selftests: Fix an IS_ERR() vs NULL check

Mika Kuoppala mika.kuoppala at linux.intel.com
Wed Mar 27 09:32:14 UTC 2019


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 at 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



More information about the Intel-gfx mailing list