[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:20:05 UTC 2019


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

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 | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/selftests/i915_request.c b/drivers/gpu/drm/i915/selftests/i915_request.c
index e6ffe2240126..7c5154dba6d6 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]) {
+		struct i915_gem_context *ctx;
+
+		ctx = live_context(i915, file);
+		if (IS_ERR(ctx)) {
 			ret = -ENOMEM;
 			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