From d297e58529217cb70e79639b13608f458332b2d0 Mon Sep 17 00:00:00 2001 From: Daniel Vetter Date: Thu, 5 Mar 2015 11:02:03 +0100 Subject: [PATCH] lib: Only warn about suspicious CRCs It is theoretically possible to hit these in the wild, so only warn about them. Dropping the test is probably too much since these caught some real bugs in the past. Signed-off-by: Daniel Vetter --- lib/igt_debugfs.c | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c index 61313aad..85c3f222 100644 --- a/lib/igt_debugfs.c +++ b/lib/igt_debugfs.c @@ -188,22 +188,6 @@ FILE *igt_debugfs_fopen(const char *filename, * Pipe CRC */ -static bool igt_crc_is_null(igt_crc_t *crc) -{ - int i; - - for (i = 0; i < crc->n_words; i++) { - igt_warn_on_f(crc->crc[i] == 0xffffffff, - "Suspicious CRC: it looks like the CRC " - "read back was from a register in a powered " - "down well\n"); - if (crc->crc[i]) - return false; - } - - return true; -} - /** * igt_assert_crc_equal: * @a: first pipe CRC value @@ -498,6 +482,23 @@ igt_pipe_crc_get_crcs(igt_pipe_crc_t *pipe_crc, int n_crcs, *out_crcs = crcs; } +static void crc_sanity_checks(igt_crc_t *crc) +{ + int i; + bool all_zero = true; + + for (i = 0; i < crc->n_words; i++) { + igt_warn_on_f(crc->crc[i] == 0xffffffff, + "Suspicious CRC: it looks like the CRC " + "read back was from a register in a powered " + "down well\n"); + if (crc->crc[i]) + all_zero = false; + } + + igt_warn_on_f(all_zero, "Suspicious CRC: All values are 0.\n"); +} + /** * igt_pipe_crc_collect_crc: * @pipe_crc: pipe CRC object @@ -515,7 +516,7 @@ void igt_pipe_crc_collect_crc(igt_pipe_crc_t *pipe_crc, igt_crc_t *out_crc) read_one_crc(pipe_crc, out_crc); igt_pipe_crc_stop(pipe_crc); - igt_assert(!igt_crc_is_null(out_crc)); + crc_sanity_checks(out_crc); } /*