diff options
author | Ville Syrjälä <ville.syrjala@linux.intel.com> | 2015-10-09 18:19:34 +0300 |
---|---|---|
committer | Ville Syrjälä <ville.syrjala@linux.intel.com> | 2015-10-09 18:33:30 +0300 |
commit | 7eaae3c2013b6d4bdf11570d3fb9d95eb4978976 (patch) | |
tree | d20ecd068c4645c7855af74452fbe2b58775a89d /tests/gem_gtt_cpu_tlb.c | |
parent | 91d295cf06aeee733b57ec87933dba47ed2c8440 (diff) |
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>
Diffstat (limited to 'tests/gem_gtt_cpu_tlb.c')
-rw-r--r-- | tests/gem_gtt_cpu_tlb.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/tests/gem_gtt_cpu_tlb.c b/tests/gem_gtt_cpu_tlb.c index 8ceef44c..75c3d043 100644 --- a/tests/gem_gtt_cpu_tlb.c +++ b/tests/gem_gtt_cpu_tlb.c @@ -60,6 +60,7 @@ create_bo(int fd) /* Fill the BO with dwords starting at start_val */ data = gem_mmap__gtt(fd, handle, OBJ_SIZE, PROT_READ | PROT_WRITE); + igt_assert(data); for (i = 0; i < OBJ_SIZE/4; i++) data[i] = i; munmap(data, OBJ_SIZE); @@ -83,6 +84,7 @@ igt_simple_main /* touch one page */ ptr = gem_mmap__gtt(fd, handle, OBJ_SIZE, PROT_READ | PROT_WRITE); + igt_assert(ptr); *ptr = 0xdeadbeef; munmap(ptr, OBJ_SIZE); |