Skip to content

Commit

Permalink
drm/i915: Fix divide by zero on watermark update
Browse files Browse the repository at this point in the history
Fix divide by zero if we end up updating the watermarks
with zero dotclock.

This is a stop gap measure to allow module load in cases
where our state keeping fails.

v2: WARN_ON added (Paulo)

Cc: Paulo Zanoni <przanoni@gmail.com>
Cc: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Reviewed-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
  • Loading branch information
Mika Kuoppala authored and Daniel Vetter committed Jul 17, 2015
1 parent 2649548 commit 661abfc
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/gpu/drm/i915/intel_pm.c
Original file line number Diff line number Diff line change
Expand Up @@ -3316,8 +3316,10 @@ skl_compute_linetime_wm(struct drm_crtc *crtc, struct skl_pipe_wm_parameters *p)
if (!to_intel_crtc(crtc)->active)
return 0;

return DIV_ROUND_UP(8 * p->pipe_htotal * 1000, p->pixel_rate);
if (WARN_ON(p->pixel_rate == 0))
return 0;

return DIV_ROUND_UP(8 * p->pipe_htotal * 1000, p->pixel_rate);
}

static void skl_compute_transition_wm(struct drm_crtc *crtc,
Expand Down

0 comments on commit 661abfc

Please sign in to comment.