drm/i915/cmtg: Warn on invalid CMTG transcoder in intel_cmtg_disable()

intel_cmtg_disable() indexes the per-transcoder register array using the
CMTG transcoder returned by to_cmtg_transcoder(), which is only valid for
TRANSCODER_A/B. The callers are now gated by intel_cmtg_is_allowed(), so
reaching this function with an invalid CMTG transcoder should never
happen.

Add a drm_WARN_ON() that bails out early in that case, both to document
the invariant and to guard against the out-of-bounds register access
(trans_offsets[-1]) should a future caller get it wrong.

v2:
- Add an in-function INVALID_TRANSCODER drm_WARN_ON check. (Suraj)

Signed-off-by: Animesh Manna <animesh.manna@intel.com>
Reviewed-by: Suraj Kandpal <suraj.kandpal@intel.com>
Link: https://patch.msgid.link/20260629180236.1353704-3-animesh.manna@intel.com
This commit is contained in:
Animesh Manna 2026-06-29 23:32:36 +05:30
parent 3e64a9e210
commit c2408fda34

View File

@ -183,6 +183,9 @@ void intel_cmtg_disable(const struct intel_crtc_state *crtc_state)
if (!crtc->cmtg.enabled)
return;
if (drm_WARN_ON(display->drm, cmtg_transcoder == INVALID_TRANSCODER))
return;
crtc->cmtg.enabled = false;
intel_de_rmw(display, TRANS_VRR_CTL(display, cmtg_transcoder),
VRR_CTL_VRR_ENABLE | VRR_CTL_FLIP_LINE_EN, 0);