[PATCH] drm/i915/selftests: Put GuC test contexts on early failures
From: Wentao Liang
Date: Tue Nov 03 2026 - 02:01:33 EST
intel_hang_guc() creates an intel_context before changing the heartbeat
interval and initializing the spinner. If either operation fails, it
jumps to err without dropping that context. intel_guc_fast_request()
also skips the context put when spinner initialization fails.
Release the context on these failure paths. The existing put after
igt_spinner_create_request() handles the later paths.
Fixes: 69142c0a5f9a ("drm/i915/guc: Add selftest for a hung GuC")
Fixes: 706785c19fe9 ("drm/i915/guc: Add a selftest for FAST_REQUEST errors")
Cc: stable@xxxxxxxxxxxxxxx
Assisted-by: DeepSeek-V4.1-Flash and OpenAI Codex
Signed-off-by: Wentao Liang <vulab@xxxxxxxxxxx>
---
drivers/gpu/drm/i915/gt/uc/selftest_guc.c | 1 +
drivers/gpu/drm/i915/gt/uc/selftest_guc_hangcheck.c | 2 ++
2 files changed, 3 insertions(+)
diff --git a/drivers/gpu/drm/i915/gt/uc/selftest_guc.c b/drivers/gpu/drm/i915/gt/uc/selftest_guc.c
index 63a75272924f..8ee4ccdb80cf 100644
--- a/drivers/gpu/drm/i915/gt/uc/selftest_guc.c
+++ b/drivers/gpu/drm/i915/gt/uc/selftest_guc.c
@@ -333,6 +333,7 @@ static int intel_guc_fast_request(void *arg)
ret = igt_spinner_init(&spin, engine->gt);
if (ret) {
gt_err(gt, "Failed to create spinner: %pe\n", ERR_PTR(ret));
+ intel_context_put(ce);
goto err_pm;
}
spinning = true;
diff --git a/drivers/gpu/drm/i915/gt/uc/selftest_guc_hangcheck.c b/drivers/gpu/drm/i915/gt/uc/selftest_guc_hangcheck.c
index 83801c992488..a7c48941ead7 100644
--- a/drivers/gpu/drm/i915/gt/uc/selftest_guc_hangcheck.c
+++ b/drivers/gpu/drm/i915/gt/uc/selftest_guc_hangcheck.c
@@ -65,12 +65,14 @@ static int intel_hang_guc(void *arg)
ret = intel_engine_set_heartbeat(engine, BEAT_INTERVAL);
if (ret) {
gt_err(gt, "Failed to boost heartbeat interval: %pe\n", ERR_PTR(ret));
+ intel_context_put(ce);
goto err;
}
ret = igt_spinner_init(&spin, engine->gt);
if (ret) {
gt_err(gt, "Failed to create spinner: %pe\n", ERR_PTR(ret));
+ intel_context_put(ce);
goto err;
}
--
2.34.1