drm/i915: Don't underflow bestppm
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Tue, 24 Sep 2013 18:26:21 +0000 (21:26 +0300)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Thu, 10 Oct 2013 10:46:50 +0000 (12:46 +0200)
We do 'bestppm - 10' in vlv_find_best_dpll() but never check whether
that might underflow. Add such a check.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Mika Kuoppala <mika.kuoppala@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/intel_display.c

index dc5077560c7400c65cda90877fc5bb72529bb121..789e6ab8fb19ca78d019a0ff498f20e0116c6ce7 100644 (file)
@@ -708,7 +708,7 @@ vlv_find_best_dpll(const intel_limit_t *limit, struct drm_crtc *crtc,
                                                bestppm = 0;
                                                flag = 1;
                                        }
-                                       if (ppm < bestppm - 10) {
+                                       if (bestppm >= 10 && ppm < bestppm - 10) {
                                                bestppm = ppm;
                                                flag = 1;
                                        }