Skip to content

Commit 6b29501

Browse files
vsyrjalagregkh
authored andcommitted
drm/i915: Avoid div-by-zero when pixel_multiplier is zero
commit 2b85886 upstream. On certain platforms pixel_multiplier is read out in .get_pipe_config(), but it also gets used to calculate the pixel clock in intel_sdvo_get_config(). If the pipe is disable but some SDVO outputs are active, we may end up dividing by zero in intel_sdvo_get_config(). To avoid the problem simply check for zero pixel_multiplier and skip the division. Another attempt at fixing this involved populating pixel_multiplier to 1 even for disabled pipes, but that triggered a WARN because SDVO_CMD_GET_CLOCK_RATE_MULT command failed and thus encoder_pixel_multiplier was left at zero and didn't match pipe_config->pixel_multiplier. The "divide by pixel_multiplier" operation got introduced here: commit 18442d0 Author: Ville Syrjälä <ville.syrjala@linux.intel.com> Date: Fri Sep 13 16:00:08 2013 +0300 drm/i915: Fix port_clock and adjusted_mode.clock readout all over and it has caused a regression on certain machines since they would hit the div-by-zero during resume. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=76520 Tested-by: Tim Richardson <tim@tim-richardson.net> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Signed-off-by: Jani Nikula <jani.nikula@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent f4db982 commit 6b29501

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎drivers/gpu/drm/i915/intel_sdvo.c‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1383,7 +1383,9 @@ static void intel_sdvo_get_config(struct intel_encoder *encoder,
13831383
>> SDVO_PORT_MULTIPLY_SHIFT) + 1;
13841384
}
13851385

1386-
dotclock = pipe_config->port_clock / pipe_config->pixel_multiplier;
1386+
dotclock = pipe_config->port_clock;
1387+
if (pipe_config->pixel_multiplier)
1388+
dotclock /= pipe_config->pixel_multiplier;
13871389

13881390
if (HAS_PCH_SPLIT(dev))
13891391
ironlake_check_encoder_dotclock(pipe_config, dotclock);

0 commit comments

Comments
 (0)