projects
/
platform
/
kernel
/
linux-rpi.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
6879216
)
drm/i915: avoid division by zero on skl_calc_wrpll_link
author
Young Xiao
<YangX92@hotmail.com>
Mon, 17 Dec 2018 12:23:03 +0000
(12:23 +0000)
committer
Jani Nikula
<jani.nikula@intel.com>
Fri, 28 Dec 2018 09:35:52 +0000
(11:35 +0200)
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@hotmail.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link:
https://patchwork.freedesktop.org/patch/msgid/SG2PR01MB2169F6E95BC8BB5E29477042ADBC0@SG2PR01MB2169.apcprd01.prod.exchangelabs.com
drivers/gpu/drm/i915/intel_ddi.c
patch
|
blob
|
history
diff --git
a/drivers/gpu/drm/i915/intel_ddi.c
b/drivers/gpu/drm/i915/intel_ddi.c
index fdf57f451b72b8fa8bf13e244b1f453811cbff35..2d6ed990a2327d2e1cad08517ec125e7f55b1c12 100644
(file)
--- a/
drivers/gpu/drm/i915/intel_ddi.c
+++ b/
drivers/gpu/drm/i915/intel_ddi.c
@@
-1296,6
+1296,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);
}