From e93e1ded5788a56a3ee78e123e2cffc281e9f0d6 Mon Sep 17 00:00:00 2001 From: Imre Deak Date: Mon, 1 Jun 2026 12:38:22 +0300 Subject: [PATCH] drm/i915/dp_link_training: Clamp sequential link training failure counter 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. Reviewed-by: Mika Kahola Signed-off-by: Imre Deak Link: https://patch.msgid.link/20260601093836.3057345-10-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 e766f7c323f7..f03e05c730a2 100644 --- a/drivers/gpu/drm/i915/display/intel_dp_link_training.c +++ b/drivers/gpu/drm/i915/display/intel_dp_link_training.c @@ -1831,7 +1831,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