Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 24be4e46 authored by Imre Deak's avatar Imre Deak Committed by Daniel Vetter
Browse files

drm/i915: check for div-by-zero in vlv_PLL_is_optimal

parent d5dd62bd
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -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);