[PATCH 013/108] drm/i915/dp_link_training: Clamp sequential link training failure counter

Imre Deak
2026-04-28T12:53:08Z

Clamp link_training->seq_train_failures to MAX_SEQ_TRAIN_FAILURES to
avoid - an unlikely - overflow. This is ok, because the code only makes
a distinction between the cases where the counter is below or at the
limit.

This also prepares for replacing the counter with an enum in a follow-up
change.

Signed-off-by: Imre Deak <imre.deak@intel.com>
---
drivers/gpu/drm/i915/display/intel_dp_link_training.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/display/intel_dp_link_training.c b/drivers/gpu/drm/i915/display/intel_dp_link_training.c
index 54f506bbd6d1d..f58bce3e0a1d3 100644
--- a/drivers/gpu/drm/i915/display/intel_dp_link_training.c
+++ b/drivers/gpu/drm/i915/display/intel_dp_link_training.c
@@ -1816,7 +1816,8 @@ void intel_dp_start_link_train(struct intel_atomic_state *state,
return;
}

- link_training->seq_train_failures++;
+ if (link_training->seq_train_failures < MAX_SEQ_TRAIN_FAILURES)
+ link_training->seq_train_failures++;

/*
* Ignore the link failure in CI
--
2.49.1