diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2018-02-19 09:13:21 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2018-02-20 09:14:52 +0000 |
commit | 4a03bd897f2d46e651c62c9fe3172cbaae20552e (patch) | |
tree | 83e41fae644b3b106b851a74e30a001b239143af /lib/igt_debugfs.c | |
parent | d7c14aa2d74475f9de9eccf350df204da8f10442 (diff) |
lib: Always set mismatching index for igt_find_crc_mismatch
igt_debugfs.c: In function 'igt_assert_crc_equal':
igt_debugfs.c:353:3: warning: 'index' may be used uninitialized in this function [-Wmaybe-uninitialized]
igt_debugfs.c: In function 'igt_check_crc_equal':
igt_debugfs.c:375:3: warning: 'index' may be used uninitialized in this function [-Wmaybe-uninitialized]
Fixes: 7422d7540a3b ("lib/igt_debugfs: Introduce CRC check function, with logic made common")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Diffstat (limited to 'lib/igt_debugfs.c')
-rw-r--r-- | lib/igt_debugfs.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c index 09d42ea0..8adc02e9 100644 --- a/lib/igt_debugfs.c +++ b/lib/igt_debugfs.c @@ -325,12 +325,10 @@ bool igt_debugfs_search(int device, const char *filename, const char *substring) static bool igt_find_crc_mismatch(const igt_crc_t *a, const igt_crc_t *b, int *index) { + int nwords = min(a->n_words, b->n_words); int i; - if (a->n_words != b->n_words) - return true; - - for (i = 0; i < a->n_words; i++) { + for (i = 0; i < nwords; i++) { if (a->crc[i] != b->crc[i]) { if (index) *index = i; @@ -339,6 +337,12 @@ static bool igt_find_crc_mismatch(const igt_crc_t *a, const igt_crc_t *b, } } + if (a->n_words != b->n_words) { + if (index) + *index = i; + return true; + } + return false; } |