[PATCH] test/gem_userptr_*: Fix compile fail

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

 



Also shut up warnings. Those revealed incorrect usage of local
variables in conjunction with igt_fixture/igt_subtest. Since those use
longjmps we need to move the out of the stackframe those magic blocks
are declared in.

Signed-off-by: Daniel Vetter <daniel.vetter@xxxxxxxx>
---
 benchmarks/gem_userptr_benchmark.c | 12 +++++++-----
 tests/gem_userptr_blits.c          | 14 +++++++++++---
 2 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/benchmarks/gem_userptr_benchmark.c b/benchmarks/gem_userptr_benchmark.c
index 9ad6e4a35687..bdfce126e960 100644
--- a/benchmarks/gem_userptr_benchmark.c
+++ b/benchmarks/gem_userptr_benchmark.c
@@ -42,8 +42,11 @@
 #include <sys/stat.h>
 #include <sys/time.h>
 #include <sys/mman.h>
+#include <signal.h>
+
 #include "drm.h"
 #include "i915_drm.h"
+
 #include "drmtest.h"
 #include "intel_bufmgr.h"
 #include "intel_batchbuffer.h"
@@ -288,7 +291,6 @@ static void test_ptr_read(void *ptr)
 	unsigned long iter = 0;
 	volatile unsigned long *p;
 	unsigned long i, loops;
-	register unsigned long v;
 
 	loops = BO_SIZE / sizeof(unsigned long) / 4;
 
@@ -297,10 +299,10 @@ static void test_ptr_read(void *ptr)
 	while (run_test) {
 		p = (unsigned long *)ptr;
 		for (i = 0; i < loops; i++) {
-			v = *p++;
-			v = *p++;
-			v = *p++;
-			v = *p++;
+			(void)*p++;
+			(void)*p++;
+			(void)*p++;
+			(void)*p++;
 		}
 		iter++;
 	}
diff --git a/tests/gem_userptr_blits.c b/tests/gem_userptr_blits.c
index 03af58ea7fe5..cec8c8fd4f04 100644
--- a/tests/gem_userptr_blits.c
+++ b/tests/gem_userptr_blits.c
@@ -46,8 +46,11 @@
 #include <sys/stat.h>
 #include <sys/time.h>
 #include <sys/mman.h>
+#include <signal.h>
+
 #include "drm.h"
 #include "i915_drm.h"
+
 #include "drmtest.h"
 #include "intel_bufmgr.h"
 #include "intel_batchbuffer.h"
@@ -1039,17 +1042,22 @@ static int test_unmap_cycles(int fd, int expected)
 	return 0;
 }
 
+unsigned int total_ram;
+uint64_t aperture_size;
+int fd, count, size = 0, ret;
+
+
 int main(int argc, char **argv)
 {
-	uint64_t aperture_size;
-	unsigned int total_ram;
-	int fd = -1, count = 0, size = 0, ret;
+	int size = sizeof(linear);
 
 	igt_skip_on_simulation();
 
 	igt_subtest_init(argc, argv);
 
 	igt_fixture {
+		int ret;
+
 		fd = drm_open_any();
 		igt_assert(fd >= 0);
 
-- 
1.9.2

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
http://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