mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2026-08-11 16:32:58 +00:00
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:
@@ -178,6 +178,7 @@ static int run(int object, int batch, int count, int reps)
|
||||
fd = drm_open_driver(DRIVER_INTEL);
|
||||
handle = gem_create(fd, size);
|
||||
buf = gem_mmap__cpu(fd, handle, 0, size, PROT_WRITE);
|
||||
igt_assert(buf);
|
||||
|
||||
gen = intel_gen(intel_get_drm_devid(fd));
|
||||
has_64bit_reloc = gen >= 8;
|
||||
|
||||
@@ -116,14 +116,17 @@ int main(int argc, char **argv)
|
||||
switch (map) {
|
||||
case CPU:
|
||||
ptr = gem_mmap__cpu(fd, handle, 0, OBJECT_SIZE, PROT_WRITE);
|
||||
igt_assert(ptr);
|
||||
gem_set_domain(fd, handle, I915_GEM_DOMAIN_CPU, I915_GEM_DOMAIN_CPU);
|
||||
break;
|
||||
case GTT:
|
||||
ptr = gem_mmap__gtt(fd, handle, OBJECT_SIZE, PROT_WRITE);
|
||||
igt_assert(ptr);
|
||||
gem_set_domain(fd, handle, I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT);
|
||||
break;
|
||||
case WC:
|
||||
ptr = gem_mmap__wc(fd, handle, 0, OBJECT_SIZE, PROT_WRITE);
|
||||
igt_assert(ptr);
|
||||
gem_set_domain(fd, handle, I915_GEM_DOMAIN_GTT, I915_GEM_DOMAIN_GTT);
|
||||
break;
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user