From 679df6f19f1ebf575f440a704bcb9fe5b6c1f7ed Mon Sep 17 00:00:00 2001 From: Ville Syrjälä Date: Fri, 16 Jun 2023 17:08:17 +0300 Subject: drm/i915: Assert that the port being initialized is valid MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sprinkle some asserts to catch any mishaps in the port_mask vs. output init. For DDI/DP/HDMI/SDVO I decided that we want to bail out for an invalid port since those are the encoder types where we might want consider driving the whole thing from the VBT child device list, and bogus VBTs could be a real issue (if for no other reason than the i915.vbt_firmware). For DVO and HSW/BDW CRT port I just threw the assert in there for good measure. Reviewed-by: Jani Nikula Signed-off-by: Ville Syrjälä Link: https://patchwork.freedesktop.org/patch/msgid/20230616140820.11726-5-ville.syrjala@linux.intel.com --- drivers/gpu/drm/i915/display/intel_sdvo.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'drivers/gpu/drm/i915/display/intel_sdvo.c') diff --git a/drivers/gpu/drm/i915/display/intel_sdvo.c b/drivers/gpu/drm/i915/display/intel_sdvo.c index 21f92123c844..d269726a832e 100644 --- a/drivers/gpu/drm/i915/display/intel_sdvo.c +++ b/drivers/gpu/drm/i915/display/intel_sdvo.c @@ -3329,6 +3329,9 @@ bool intel_sdvo_init(struct drm_i915_private *dev_priv, struct intel_sdvo *intel_sdvo; int i; + if (!assert_port_valid(dev_priv, port)) + return false; + assert_sdvo_port_valid(dev_priv, port); intel_sdvo = kzalloc(sizeof(*intel_sdvo), GFP_KERNEL); -- cgit