diff mbox series

drm/i915/selftests: Fix an IS_ERR() vs NULL check

Message ID 20190327093214.19813-1-mika.kuoppala@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915/selftests: Fix an IS_ERR() vs NULL check | expand

Commit Message

Mika Kuoppala March 27, 2019, 9:32 a.m. UTC
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(-)

Comments

Chris Wilson March 27, 2019, 9:52 a.m. UTC | #1
Quoting Mika Kuoppala (2019-03-27 09:32:14)
> 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>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris
diff mbox series

Patch

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__, "");