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/gem_userptr_blits.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'tests/gem_userptr_blits.c') diff --git a/tests/gem_userptr_blits.c b/tests/gem_userptr_blits.c index 6fff3a9e..e6830f6b 100644 --- a/tests/gem_userptr_blits.c +++ b/tests/gem_userptr_blits.c @@ -689,10 +689,12 @@ static void *umap(int fd, uint32_t handle) if (gem_has_llc(fd)) { ptr = gem_mmap__gtt(fd, handle, sizeof(linear), PROT_READ | PROT_WRITE); + igt_assert(ptr); } else { uint32_t tmp = gem_create(fd, sizeof(linear)); copy(fd, tmp, handle, 0); ptr = gem_mmap__cpu(fd, tmp, 0, sizeof(linear), PROT_READ); + igt_assert(ptr); gem_close(fd, tmp); } -- cgit v1.2.3