Sprinkle igt_assert(ptr) after gem_mmap__{cpu,gtt,wc}

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ä <ville.syrjala@linux.intel.com>
Stochastically-reviwewed-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Ville Syrjälä
2015-10-09 18:19:34 +03:00
parent 91d295cf06
commit 7eaae3c201
23 changed files with 77 additions and 9 deletions
+1
View File
@@ -124,6 +124,7 @@ igt_simple_main
size = ALIGN(sizeof(mem_reloc), 4096);
reloc_handle = gem_create(fd, size);
reloc = gem_mmap__cpu(fd, reloc_handle, 0, size, PROT_READ | PROT_WRITE);
igt_assert(reloc);
for (n = 0; n < MAX_NUM_RELOC; n++) {
reloc[n].offset = 1024;
reloc[n].read_domains = I915_GEM_DOMAIN_RENDER;