[igt-dev] [PATCH igt 04/16] igt/gem_exec_flush: Silence old compiler warning

Chris Wilson chris at chris-wilson.co.uk
Tue Feb 20 08:45:08 UTC 2018


gem_exec_flush.c: In function ‘batch’:
gem_exec_flush.c:443:15: warning: ‘ptr’ may be used uninitialized in this function [-Wmaybe-uninitialized]

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
 tests/gem_exec_flush.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tests/gem_exec_flush.c b/tests/gem_exec_flush.c
index c93eee4b..f820b2a8 100644
--- a/tests/gem_exec_flush.c
+++ b/tests/gem_exec_flush.c
@@ -426,6 +426,11 @@ static void batch(int fd, unsigned ring, int nchild, int timeout,
 			ptr = mmap(0, 64<<10, PROT_WRITE,
 				   MAP_PRIVATE | MAP_ANON, -1, 0);
 			break;
+
+		default:
+			igt_assert(!"reachable");
+			ptr = NULL;
+			break;
 		}
 
 		memset(&reloc, 0, sizeof(reloc));
-- 
2.16.1



More information about the igt-dev mailing list