[Intel-gfx] [PATCH] drm/i915/selftests: fix some error codes in __cancel_reset()

Dan Carpenter dan.carpenter at oracle.com
Thu Jan 27 08:49:15 UTC 2022


There were two error paths in __cancel_reset() which return success
instead of a negative error code as expected.

Fixes: 4e6835466771 ("drm/i915/selftests: Add a cancel request selftest that triggers a reset")
Signed-off-by: Dan Carpenter <dan.carpenter at oracle.com>
---
>From static analysis.  I am not 100% sure this.  Please review extra
carefully!

 drivers/gpu/drm/i915/selftests/i915_request.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/selftests/i915_request.c b/drivers/gpu/drm/i915/selftests/i915_request.c
index 2a99dd7c2fe8..05e9f977757b 100644
--- a/drivers/gpu/drm/i915/selftests/i915_request.c
+++ b/drivers/gpu/drm/i915/selftests/i915_request.c
@@ -809,7 +809,8 @@ static int __cancel_reset(struct drm_i915_private *i915,
 	preempt_timeout_ms = engine->props.preempt_timeout_ms;
 	engine->props.preempt_timeout_ms = 100;
 
-	if (igt_spinner_init(&spin, engine->gt))
+	err = igt_spinner_init(&spin, engine->gt);
+	if (err)
 		goto out_restore;
 
 	ce = intel_context_create(engine);
@@ -838,8 +839,10 @@ static int __cancel_reset(struct drm_i915_private *i915,
 	}
 
 	nop = intel_context_create_request(ce);
-	if (IS_ERR(nop))
+	if (IS_ERR(nop)) {
+		err = PTR_ERR(nop);
 		goto out_rq;
+	}
 	i915_request_get(nop);
 	i915_request_add(nop);
 
-- 
2.20.1



More information about the Intel-gfx mailing list