Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915/gt: Do not destroy uninitialized timer
@ 2026-09-29 11:12 Krzysztof Karas
  2026-09-29 11:19 ` Jani Nikula
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Krzysztof Karas @ 2026-09-29 11:12 UTC (permalink / raw)
  To: intel-gfx
  Cc: Andi Shyti, Janusz Krzysztofik, Sebastian Brzezinka,
	Krzysztof Niemiec, Krzysztof Karas

If intel_ring_begin() fails in live_emit_pte_full_ring(), then
cleanup is performed on an uninitialized timer.

Check if the timer has been set up, before trying to remove it.

Assisted-by: Copilot-Claude-Opus-5
Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
---
 drivers/gpu/drm/i915/gt/selftest_migrate.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/gt/selftest_migrate.c b/drivers/gpu/drm/i915/gt/selftest_migrate.c
index 5b986a7687d9..6793ba028146 100644
--- a/drivers/gpu/drm/i915/gt/selftest_migrate.c
+++ b/drivers/gpu/drm/i915/gt/selftest_migrate.c
@@ -552,6 +552,7 @@ static int live_emit_pte_full_ring(void *arg)
 	struct intel_context *ce;
 	struct i915_request *rq, *prev;
 	struct spinner_timer st;
+	bool timer_set = false;
 	struct sgt_dma it;
 	int len, sz, err;
 	u32 *cs;
@@ -641,6 +642,7 @@ static int live_emit_pte_full_ring(void *arg)
 
 	timer_setup_on_stack(&st.timer, spinner_kill, 0);
 	mod_timer(&st.timer, jiffies + 2 * HZ);
+	timer_set = true;
 
 	/*
 	 * This should wait for the spinner to be killed, otherwise we should go
@@ -660,8 +662,10 @@ static int live_emit_pte_full_ring(void *arg)
 
 out_rq:
 	i915_request_add(rq); /* GEM_BUG_ON(rq->reserved_space > ring->space)? */
-	timer_delete_sync(&st.timer);
-	timer_destroy_on_stack(&st.timer);
+	if (timer_set) {
+		timer_delete_sync(&st.timer);
+		timer_destroy_on_stack(&st.timer);
+	}
 out_unpin:
 	intel_context_unpin(ce);
 out_put:
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-09-29 16:58 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-29 11:12 [PATCH] drm/i915/gt: Do not destroy uninitialized timer Krzysztof Karas
2026-09-29 11:19 ` Jani Nikula
2026-09-29 11:42 ` Sebastian Brzezinka
2026-09-29 12:43   ` Jani Nikula
2026-09-29 13:26 ` ✓ i915.CI.BAT: success for " Patchwork
2026-09-29 16:58 ` ✗ i915.CI.Full: failure " Patchwork

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox