mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] drm/i915/display: Pass crtc->pipe to intel_pmdemand_update_port_clock()
@ 2026-11-19 17:06 Ian Rogers
  0 siblings, 0 replies; only message in thread
From: Ian Rogers @ 2026-11-19 17:06 UTC (permalink / raw)
  To: Jani Nikula, Rodrigo Vivi, Joonas Lahtinen, Tvrtko Ursulin,
	David Airlie, Simona Vetter
  Cc: intel-gfx, intel-xe, dri-devel, linux-kernel, llvm, Elkin Cruz,
	Ian Rogers

In intel_modeset_readout_hw_state(), 'pipe' is only populated inside the
earlier for_each_intel_encoder() loop. Later, inside
for_each_intel_crtc(), intel_pmdemand_update_port_clock() is called with
'pipe' instead of 'crtc->pipe'.

When the encoder list is empty (for example on headless SKUs or VBT
configurations with all display outputs disabled), 'pipe' is completely
uninitialized and indexes out-of-bounds into pmdemand_state->ddi_clocks[].
Even when encoders are present, every CRTC iteration overwrites the slot
for the last encoder's pipe rather than updating crtc->pipe.

Scope 'pipe' locally to for_each_intel_encoder() and pass crtc->pipe to
intel_pmdemand_update_port_clock().

Found via an x86_64 LLVM=1 (Clang 21.1.8) allyesconfig audit with
-Wconditional-uninitialized enabled; fix and changelog drafted with an AI
coding assistant. Build-tested for both i915 and xe under LLVM=1 W=1
(-Werror) and -Wconditional-uninitialized; not runtime-tested on Intel
Xe_LPD+ hardware.

Fixes: 4c4cc7ac207f ("drm/i915/mtl: Add support for PM DEMAND")
Signed-off-by: Ian Rogers <irogers@google.com>
---
 drivers/gpu/drm/i915/display/intel_modeset_setup.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_modeset_setup.c b/drivers/gpu/drm/i915/display/intel_modeset_setup.c
index 6aed88173770..e5d7c05e006a 100644
--- a/drivers/gpu/drm/i915/display/intel_modeset_setup.c
+++ b/drivers/gpu/drm/i915/display/intel_modeset_setup.c
@@ -695,7 +695,6 @@ static void intel_modeset_readout_hw_state(struct intel_display *display)
 {
 	struct intel_pmdemand_state *pmdemand_state =
 		to_intel_pmdemand_state(display->pmdemand.obj.state);
-	enum pipe pipe;
 	struct intel_crtc *crtc;
 	struct intel_encoder *encoder;
 	struct intel_connector *connector;
@@ -726,8 +725,7 @@ static void intel_modeset_readout_hw_state(struct intel_display *display)
 
 	for_each_intel_encoder(display->drm, encoder) {
 		struct intel_crtc_state *crtc_state = NULL;
-
-		pipe = 0;
+		enum pipe pipe = PIPE_A;
 
 		if (encoder->get_hw_state(encoder, &pipe)) {
 			crtc = intel_crtc_for_pipe(display, pipe);
@@ -869,7 +867,8 @@ static void intel_modeset_readout_hw_state(struct intel_display *display)
 		drm_dbg_kms(display->drm, "[CRTC:%d:%s] min_cdclk %d kHz\n",
 			    crtc->base.base.id, crtc->base.name, crtc_state->min_cdclk);
 
-		intel_pmdemand_update_port_clock(display, pmdemand_state, pipe,
+		intel_pmdemand_update_port_clock(display, pmdemand_state,
+						 crtc->pipe,
 						 crtc_state->port_clock);
 	}
 
-- 
2.56.1.708.g77570a6a1d-goog


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-19 17:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-19 17:06 [PATCH] drm/i915/display: Pass crtc->pipe to intel_pmdemand_update_port_clock() Ian Rogers

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

all inboxes | Powered by JetHome®