All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH igt 1/4] lib: Always set mismatching index for igt_find_crc_mismatch
@ 2018-02-19 20:12 Chris Wilson
  2018-02-19 20:12 ` [PATCH igt 2/4] igt/gem_exec_flush: Silence old compiler warning Chris Wilson
                   ` (5 more replies)
  0 siblings, 6 replies; 10+ messages in thread
From: Chris Wilson @ 2018-02-19 20:12 UTC (permalink / raw)
  To: intel-gfx

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>
---
 lib/igt_debugfs.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c
index 4a119985..7399ae23 100644
--- a/lib/igt_debugfs.c
+++ b/lib/igt_debugfs.c
@@ -315,12 +315,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;
@@ -329,6 +327,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;
 }
 
-- 
2.16.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2018-02-20  9:01 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-19 20:12 [PATCH igt 1/4] lib: Always set mismatching index for igt_find_crc_mismatch Chris Wilson
2018-02-19 20:12 ` [PATCH igt 2/4] igt/gem_exec_flush: Silence old compiler warning Chris Wilson
2018-02-20  8:58   ` Joonas Lahtinen
2018-02-19 20:12 ` [PATCH igt 3/4] igt/syncobj: Tidy ye olde compiler warnings Chris Wilson
2018-02-20  8:59   ` Joonas Lahtinen
2018-02-19 20:12 ` [PATCH igt 4/4] lib: Remove overzealous assertion on gem_set_caching() Chris Wilson
2018-02-20  9:01   ` Joonas Lahtinen
2018-02-19 20:36 ` ✓ Fi.CI.BAT: success for series starting with [1/4] lib: Always set mismatching index for igt_find_crc_mismatch Patchwork
2018-02-20  0:17 ` ✓ Fi.CI.IGT: " Patchwork
2018-02-20  8:57 ` [PATCH igt 1/4] " Joonas Lahtinen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.