From: Imre Deak Date: Tue, 17 Mar 2015 09:40:04 +0000 (+0200) Subject: drm/i915: check for div-by-zero in vlv_PLL_is_optimal X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=24be4e4650de2fc323ee0737f945ad366b6c11cc;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git drm/i915: check for div-by-zero in vlv_PLL_is_optimal Signed-off-by: Imre Deak Reviewed-by: Jesse Barnes Signed-off-by: Daniel Vetter --- diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 9dc9a85d0008..b0aa6a4784c4 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -786,6 +786,9 @@ static bool vlv_PLL_is_optimal(struct drm_device *dev, int target_freq, unsigned int best_error_ppm, unsigned int *error_ppm) { + if (WARN_ON_ONCE(!target_freq)) + return false; + *error_ppm = div_u64(1000000ULL * abs(target_freq - calculated_clock->dot), target_freq);