summaryrefslogtreecommitdiff
path: root/tests/gem_mmap_wc.c
diff options
context:
space:
mode:
authorVille Syrjälä <ville.syrjala@linux.intel.com>2015-10-09 17:00:29 +0300
committerVille Syrjälä <ville.syrjala@linux.intel.com>2015-10-09 17:09:45 +0300
commit91d295cf06aeee733b57ec87933dba47ed2c8440 (patch)
treee7701a2e4470ae638d760266e0477f8ac5b689f6 /tests/gem_mmap_wc.c
parent8986bbc0ce83c1df4c314c9c04d30608cacae98b (diff)
Remove gem_mmap__{cpu,gtt,wc} return value MAP_FAILED asserts
gem_mmap__{cpu,gtt,wc} never return MAP_FAILED, it gets converted to NULL internally. So don't go asserting that the returned value is not MAP_FAILED. Done with coccinelle: @@ type T; identifier I; @@ ( I = gem_mmap__gtt(...); | I = gem_mmap__cpu(...); | I = gem_mmap__wc(...); ) ... ( - igt_assert(I != MAP_FAILED); + igt_assert(I); | - igt_assert(I && I != MAP_FAILED); + igt_assert(I); | - igt_assert(I != (T *) MAP_FAILED); + igt_assert(I); | - igt_assert(I != NULL); + igt_assert(I); ) Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Stochastically-reviwewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'tests/gem_mmap_wc.c')
-rw-r--r--tests/gem_mmap_wc.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/tests/gem_mmap_wc.c b/tests/gem_mmap_wc.c
index e312805f..11463ca3 100644
--- a/tests/gem_mmap_wc.c
+++ b/tests/gem_mmap_wc.c
@@ -63,7 +63,7 @@ mmap_bo(int fd, uint32_t handle)
void *ptr;
ptr = gem_mmap__wc(fd, handle, 0, OBJECT_SIZE, PROT_READ | PROT_WRITE);
- igt_assert(ptr && ptr != MAP_FAILED);
+ igt_assert(ptr);
return ptr;
}
@@ -184,10 +184,10 @@ test_read_write2(int fd, enum test_read_write order)
set_domain(fd, handle);
r = gem_mmap__wc(fd, handle, 0, OBJECT_SIZE, PROT_READ);
- igt_assert(r != MAP_FAILED);
+ igt_assert(r);
w = gem_mmap__wc(fd, handle, 0, OBJECT_SIZE, PROT_READ | PROT_WRITE);
- igt_assert(w != MAP_FAILED);
+ igt_assert(w);
if (order == READ_BEFORE_WRITE) {
val = *(uint32_t *)r;
@@ -289,10 +289,10 @@ test_write_cpu_read_wc(int fd, int force_domain)
handle = gem_create(fd, OBJECT_SIZE);
dst = gem_mmap__wc(fd, handle, 0, OBJECT_SIZE, PROT_READ);
- igt_assert(dst != (uint32_t *)MAP_FAILED);
+ igt_assert(dst);
src = gem_mmap__cpu(fd, handle, 0, OBJECT_SIZE, PROT_WRITE);
- igt_assert(src != (uint32_t *)MAP_FAILED);
+ igt_assert(src);
memset(src, 0xaa, OBJECT_SIZE);
if (force_domain)
@@ -316,10 +316,10 @@ test_write_gtt_read_wc(int fd)
set_domain(fd, handle);
dst = gem_mmap__wc(fd, handle, 0, OBJECT_SIZE, PROT_READ);
- igt_assert(dst != (uint32_t *)MAP_FAILED);
+ igt_assert(dst);
src = gem_mmap__gtt(fd, handle, OBJECT_SIZE, PROT_WRITE);
- igt_assert(src != (uint32_t *)MAP_FAILED);
+ igt_assert(src);
memset(src, 0xaa, OBJECT_SIZE);
igt_assert(memcmp(dst, src, OBJECT_SIZE) == 0);