Skip to content

Commit 60a43ec

Browse files
committed
drm/i915/ddi: only call shutdown hooks for valid encoders
DDI might be HDMI or DP only, leaving the other encoder uninitialized. Calling the shutdown hook on an uninitialized encoder may lead to a NULL pointer dereference. Check the encoder types (and thus validity via the DP output_reg or HDMI hdmi_reg checks) before calling the hooks. Reported-and-tested-by: Sergey Senozhatsky <[email protected]> Closes: https://lore.kernel.org/r/[email protected] Cc: Sergey Senozhatsky <[email protected]> Cc: Ville Syrjala <[email protected]> Reviewed-by: Suraj Kandpal <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/8b197c50e7f3be2bbc07e3935b21e919815015d5.1735568047.git.jani.nikula@intel.com Signed-off-by: Jani Nikula <[email protected]>
1 parent efa43b7 commit 60a43ec

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

drivers/gpu/drm/i915/display/intel_ddi.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4923,8 +4923,10 @@ static void intel_ddi_tc_encoder_suspend_complete(struct intel_encoder *encoder)
49234923

49244924
static void intel_ddi_encoder_shutdown(struct intel_encoder *encoder)
49254925
{
4926-
intel_dp_encoder_shutdown(encoder);
4927-
intel_hdmi_encoder_shutdown(encoder);
4926+
if (intel_encoder_is_dp(encoder))
4927+
intel_dp_encoder_shutdown(encoder);
4928+
if (intel_encoder_is_hdmi(encoder))
4929+
intel_hdmi_encoder_shutdown(encoder);
49284930
}
49294931

49304932
static void intel_ddi_tc_encoder_shutdown_complete(struct intel_encoder *encoder)

0 commit comments

Comments
 (0)