[PATCH 15/21] drm/i915/selftests: fix error handling in guc_steal_ids
Matthew Auld
matthew.auld at intel.com
Mon Jan 24 15:52:39 UTC 2022
Decrementing the context_index looks like a bug. Also ensure we drop the
reference to the last rq, otherwise we are leaking the context etc.
Signed-off-by: Matthew Auld <matthew.auld at intel.com>
---
drivers/gpu/drm/i915/gt/uc/selftest_guc.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/i915/gt/uc/selftest_guc.c b/drivers/gpu/drm/i915/gt/uc/selftest_guc.c
index d3327b802b76..7ec2587aea52 100644
--- a/drivers/gpu/drm/i915/gt/uc/selftest_guc.c
+++ b/drivers/gpu/drm/i915/gt/uc/selftest_guc.c
@@ -189,7 +189,7 @@ static int intel_guc_steal_guc_ids(void *arg)
while (ret != -EAGAIN) {
ce[++context_index] = intel_context_create(engine);
if (IS_ERR(ce[context_index])) {
- ret = PTR_ERR(ce[context_index--]);
+ ret = PTR_ERR(ce[context_index]);
ce[context_index] = NULL;
pr_err("Failed to create context: %d\n", ret);
goto err_spin_rq;
@@ -226,6 +226,7 @@ static int intel_guc_steal_guc_ids(void *arg)
/* Wait for last request */
ret = i915_request_wait(last, 0, HZ * 30);
i915_request_put(last);
+ last = NULL;
if (ret < 0) {
pr_err("Last request failed to complete: %d\n", ret);
goto err_spin_rq;
@@ -271,6 +272,8 @@ static int intel_guc_steal_guc_ids(void *arg)
igt_spinner_fini(&spin);
intel_gt_wait_for_idle(gt, HZ * 30);
}
+ if (last)
+ i915_request_put(last);
err_contexts:
for (; context_index >= 0 && ce[context_index]; --context_index)
intel_context_put(ce[context_index]);
--
2.31.1
More information about the Intel-gfx-trybot
mailing list