drm/i915: Make intel_get_crtc_new_encoder() less oopsy
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Thu, 13 Apr 2023 20:06:02 +0000 (23:06 +0300)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Fri, 14 Apr 2023 18:52:43 +0000 (21:52 +0300)
The point of the WARN was to print something, not oops
straight up. Currently that is precisely what happens
if we can't find the connector for the crtc in the atomic
state. Get the dev pointer from the atomic state instead
of the potentially NULL encoder to avoid that.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230413200602.6037-2-ville.syrjala@linux.intel.com
Fixes: 3a47ae201e07 ("drm/i915/display: Make WARN* drm specific where encoder ptr is available")
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
drivers/gpu/drm/i915/display/intel_display.c

index 2d42158..52a5857 100644 (file)
@@ -959,7 +959,7 @@ intel_get_crtc_new_encoder(const struct intel_atomic_state *state,
                num_encoders++;
        }
 
-       drm_WARN(encoder->base.dev, num_encoders != 1,
+       drm_WARN(state->base.dev, num_encoders != 1,
                 "%d encoders for pipe %c\n",
                 num_encoders, pipe_name(master_crtc->pipe));