summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/i915_debugfs.c
diff options
context:
space:
mode:
authorChris Wilson2017-02-18 12:27:08 +0100
committerChris Wilson2017-02-20 12:03:30 +0100
commit23f4a287fc97d94b6110ee0e17ec92670cc8de89 (patch)
treec65b6805594d60ed9ee730df968efd82b123cfa2 /drivers/gpu/drm/i915/i915_debugfs.c
parentdrm/i915: Remove unneeded struct_mutex around rpm (diff)
downloadkernel-qcow2-linux-23f4a287fc97d94b6110ee0e17ec92670cc8de89.tar.gz
kernel-qcow2-linux-23f4a287fc97d94b6110ee0e17ec92670cc8de89.tar.xz
kernel-qcow2-linux-23f4a287fc97d94b6110ee0e17ec92670cc8de89.zip
drm/i915: Prevent divide-by-zero in debugfs/i915_rps_boost_info
Either by chance, or by misread, the current evaluation interval may be zero. If that is the case, don't divide by it! Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Link: http://patchwork.freedesktop.org/patch/msgid/20170218112708.24504-1-chris@chris-wilson.co.uk Reviewed-by: Radoslaw Szwichtenberg <radoslaw.szwichtenberg@intel.com>
Diffstat (limited to 'drivers/gpu/drm/i915/i915_debugfs.c')
-rw-r--r--drivers/gpu/drm/i915/i915_debugfs.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index 404394ef4b14..768461f7c7c6 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -2356,10 +2356,10 @@ static int i915_rps_boost_info(struct seq_file *m, void *data)
seq_printf(m, "\nRPS Autotuning (current \"%s\" window):\n",
rps_power_to_str(dev_priv->rps.power));
seq_printf(m, " Avg. up: %d%% [above threshold? %d%%]\n",
- 100 * rpup / rpupei,
+ rpup && rpupei ? 100 * rpup / rpupei : 0,
dev_priv->rps.up_threshold);
seq_printf(m, " Avg. down: %d%% [below threshold? %d%%]\n",
- 100 * rpdown / rpdownei,
+ rpdown && rpdownei ? 100 * rpdown / rpdownei : 0,
dev_priv->rps.down_threshold);
} else {
seq_puts(m, "\nRPS Autotuning inactive\n");