drm/i915: avoid division by zero on cnl_calc_wrpll_link
authorPaulo Zanoni <[email protected]>
Thu, 5 Oct 2017 21:38:42 +0000 (18:38 -0300)
committerPaulo Zanoni <[email protected]>
Mon, 9 Oct 2017 20:48:18 +0000 (17:48 -0300)
commit0e005888b833ba65dcf2c7aa12958dad6b2b8618
tree57ff2e3bf33ff5a6fa9f938a42407ef794283bca
parent2de3813880bf16deff8223add4d7e1872c7a9e77
drm/i915: avoid division by zero on cnl_calc_wrpll_link

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.

I don't expect this to happen in the wild with the current code, but I
accidentally triggered the division by zero while doing some debugging
in an unusual environment.

Cc: Rodrigo Vivi <[email protected]>
Signed-off-by: Paulo Zanoni <[email protected]>
Reviewed-by: Rodrigo Vivi <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
drivers/gpu/drm/i915/intel_ddi.c