Re: [PATCH] drm/i915: avoid division by zero on skl_calc_wrpll_link

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 17 Dec 2018, Yang Xiao <YangX92@xxxxxxxxxxx> wrote:
> From: Young Xiao <YangX92@xxxxxxxxxxx>
>
> If for some unexpected reason the registers all read zero it's better
> to WARN and return instead of dividing by zero and completely freezing
> the machine.
>
> See commit 0e005888b833 ("drm/i915: avoid division by zero on
> cnl_calc_wrpll_link") for detail.
>
> Signed-off-by: Young Xiao <YangX92@xxxxxxxxxxx>

Pushed to drm-intel-next-queued, thanks for the patch.

BR,
Jani.

> ---
>  drivers/gpu/drm/i915/intel_ddi.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
> index 5186cd7..cfa7d6f 100644
> --- a/drivers/gpu/drm/i915/intel_ddi.c
> +++ b/drivers/gpu/drm/i915/intel_ddi.c
> @@ -1360,6 +1360,9 @@ static int skl_calc_wrpll_link(struct drm_i915_private *dev_priv,
>  	dco_freq += (((cfgcr1_val & DPLL_CFGCR1_DCO_FRACTION_MASK) >> 9) * 24 *
>  		1000) / 0x8000;
>  
> +	if (WARN_ON(p0 == 0 || p1 == 0 || p2 == 0))
> +		return 0;
> +
>  	return dco_freq / (p0 * p1 * p2 * 5);
>  }

-- 
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux