diff options
author | Imre Deak <imre.deak@intel.com> | 2015-03-17 05:40:04 -0400 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2015-03-20 06:48:21 -0400 |
commit | 24be4e4650de2fc323ee0737f945ad366b6c11cc (patch) | |
tree | 9ed8e204869a1ed7c2fcaac7860c074757a8cd78 /drivers/gpu/drm/i915/intel_display.c | |
parent | d5dd62bd9a19bcea4bcf20f66de56591fdd0d8d2 (diff) |
drm/i915: check for div-by-zero in vlv_PLL_is_optimal
Signed-off-by: Imre Deak <imre.deak@intel.com>
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm/i915/intel_display.c')
-rw-r--r-- | drivers/gpu/drm/i915/intel_display.c | 3 |
1 files changed, 3 insertions, 0 deletions
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, | |||
786 | unsigned int best_error_ppm, | 786 | unsigned int best_error_ppm, |
787 | unsigned int *error_ppm) | 787 | unsigned int *error_ppm) |
788 | { | 788 | { |
789 | if (WARN_ON_ONCE(!target_freq)) | ||
790 | return false; | ||
791 | |||
789 | *error_ppm = div_u64(1000000ULL * | 792 | *error_ppm = div_u64(1000000ULL * |
790 | abs(target_freq - calculated_clock->dot), | 793 | abs(target_freq - calculated_clock->dot), |
791 | target_freq); | 794 | target_freq); |