[PATCH igt 3/4] igt/syncobj: Tidy ye olde compiler warnings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



syncobj_basic.c: In function ‘__real_main225’:
syncobj_basic.c:202:26: warning: ‘fd’ may be used uninitialized in this function [-Wmaybe-uninitialized]
syncobj_basic.c:227:6: note: ‘fd’ was declared here
syncobj_wait.c: In function ‘test_wait_complex’:
syncobj_wait.c:702:3: warning: ‘first_signaled’ may be used uninitialized in this function [-Wmaybe-uninitialized]
syncobj_wait.c: In function ‘__real_main758’:
syncobj_wait.c:492:24: warning: ‘timeline’ may be used uninitialized in this function [-Wmaybe-uninitialized]
syncobj_wait.c:473:15: note: ‘timeline’ was declared here
syncobj_wait.c:326:23: warning: ‘timeline’ may be used uninitialized in this function [-Wmaybe-uninitialized]
syncobj_wait.c:320:6: note: ‘timeline’ was declared here
syncobj_wait.c:406:31: warning: ‘fd’ may be used uninitialized in this function [-Wmaybe-uninitialized]
syncobj_wait.c:760:6: note: ‘fd’ was declared here

Signed-off-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>
---
 tests/syncobj_basic.c |  2 +-
 tests/syncobj_wait.c  | 12 +++++++-----
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/tests/syncobj_basic.c b/tests/syncobj_basic.c
index acc4a641..44769d3b 100644
--- a/tests/syncobj_basic.c
+++ b/tests/syncobj_basic.c
@@ -187,7 +187,7 @@ static bool has_syncobj(int fd)
 
 igt_main
 {
-	int fd;
+	int fd = -1;
 
 	igt_fixture {
 		fd = drm_open_driver(DRIVER_ANY);
diff --git a/tests/syncobj_wait.c b/tests/syncobj_wait.c
index 49e6d372..04d79de7 100644
--- a/tests/syncobj_wait.c
+++ b/tests/syncobj_wait.c
@@ -317,7 +317,7 @@ test_single_wait(int fd, uint32_t test_flags, int expect)
 {
 	uint32_t syncobj = syncobj_create(fd, 0);
 	uint32_t flags = flags_for_test_flags(test_flags);
-	int timeline;
+	int timeline = -1;
 
 	if (test_flags & (WAIT_SUBMITTED | WAIT_SIGNALED))
 		timeline = syncobj_attach_sw_sync(fd, syncobj);
@@ -336,6 +336,8 @@ test_single_wait(int fd, uint32_t test_flags, int expect)
 	}
 
 	syncobj_destroy(fd, syncobj);
+	if (timeline != -1)
+		close(timeline);
 }
 
 static void
@@ -343,7 +345,7 @@ test_wait_delayed_signal(int fd, uint32_t test_flags)
 {
 	uint32_t syncobj = syncobj_create(fd, 0);
 	uint32_t flags = flags_for_test_flags(test_flags);
-	int timeline;
+	int timeline = -1;
 	timer_t timer;
 
 	if (test_flags & WAIT_FOR_SUBMIT) {
@@ -360,7 +362,7 @@ test_wait_delayed_signal(int fd, uint32_t test_flags)
 
 	timer_delete(timer);
 
-	if (!(test_flags & WAIT_FOR_SUBMIT))
+	if (timeline != -1)
 		close(timeline);
 
 	syncobj_destroy(fd, syncobj);
@@ -614,7 +616,7 @@ test_wait_complex(int fd, uint32_t test_flags)
 	uint32_t syncobjs[8];
 	enum syncobj_stage stage[8];
 	int i, j, timelines[8];
-	uint32_t first_signaled, num_signaled;
+	uint32_t first_signaled = -1, num_signaled = 0;
 	pthread_t thread;
 
 	for (i = 0; i < 8; i++) {
@@ -757,7 +759,7 @@ has_syncobj_wait(int fd)
 
 igt_main
 {
-	int fd;
+	int fd = -1;
 
 	igt_fixture {
 		fd = drm_open_driver(DRIVER_ANY);
-- 
2.16.1

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




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux