From 7eaae3c2013b6d4bdf11570d3fb9d95eb4978976 Mon Sep 17 00:00:00 2001 From: Ville Syrjälä Date: Fri, 9 Oct 2015 18:19:34 +0300 Subject: Sprinkle igt_assert(ptr) after gem_mmap__{cpu,gtt,wc} MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Do the following ptr = gem_mmap__{cpu,gtt,wc}() +igt_assert(ptr); whenever the code doesn't handle the NULL ptr in any kind of specific way. Makes it easier to move the assert into gem_mmap__{cpu,gtt,wc}() itself. Mostly done with coccinelle, with some manual cleanups: @@ identifier I; @@ <... when != igt_assert(I) when != igt_require(I) when != igt_require_f(I, ...) when != I != NULL when != I == NULL ( I = gem_mmap__gtt(...); + igt_assert(I); | I = gem_mmap__cpu(...); + igt_assert(I); | I = gem_mmap__wc(...); + igt_assert(I); ) ...> Signed-off-by: Ville Syrjälä Stochastically-reviwewed-by: Chris Wilson --- tests/prime_self_import.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tests/prime_self_import.c') diff --git a/tests/prime_self_import.c b/tests/prime_self_import.c index eb9ab065..582c375c 100644 --- a/tests/prime_self_import.c +++ b/tests/prime_self_import.c @@ -61,9 +61,9 @@ check_bo(int fd1, uint32_t handle1, int fd2, uint32_t handle2) int i; ptr1 = gem_mmap__gtt(fd1, handle1, BO_SIZE, PROT_READ | PROT_WRITE); - ptr2 = gem_mmap__gtt(fd2, handle2, BO_SIZE, PROT_READ | PROT_WRITE); - igt_assert(ptr1); + ptr2 = gem_mmap__gtt(fd2, handle2, BO_SIZE, PROT_READ | PROT_WRITE); + igt_assert(ptr2); /* check whether it's still our old object first. */ for (i = 0; i < BO_SIZE; i++) { -- cgit v1.2.3