summaryrefslogtreecommitdiff
path: root/tests/pm_rpm.c
diff options
context:
space:
mode:
authorVille Syrjälä <ville.syrjala@linux.intel.com>2015-10-09 18:19:34 +0300
committerVille Syrjälä <ville.syrjala@linux.intel.com>2015-10-09 18:33:30 +0300
commit7eaae3c2013b6d4bdf11570d3fb9d95eb4978976 (patch)
treed20ecd068c4645c7855af74452fbe2b58775a89d /tests/pm_rpm.c
parent91d295cf06aeee733b57ec87933dba47ed2c8440 (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/pm_rpm.c')
-rw-r--r--tests/pm_rpm.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/tests/pm_rpm.c b/tests/pm_rpm.c
index 3364157e..026220ba 100644
--- a/tests/pm_rpm.c
+++ b/tests/pm_rpm.c
@@ -972,11 +972,15 @@ static void gem_mmap_subtest(bool gtt_mmap)
handle = gem_create(drm_fd, buf_size);
- if (gtt_mmap)
+ if (gtt_mmap) {
gem_buf = gem_mmap__gtt(drm_fd, handle, buf_size,
PROT_READ | PROT_WRITE);
- else
+ igt_assert(gem_buf);
+ }
+ else {
gem_buf = gem_mmap__cpu(drm_fd, handle, 0, buf_size, 0);
+ igt_assert(gem_buf);
+ }
for (i = 0; i < buf_size; i++)
@@ -1007,11 +1011,15 @@ static void gem_mmap_subtest(bool gtt_mmap)
* suspended. */
disable_all_screens_and_wait(&ms_data);
- if (gtt_mmap)
+ if (gtt_mmap) {
gem_buf = gem_mmap__gtt(drm_fd, handle, buf_size,
PROT_READ | PROT_WRITE);
- else
+ igt_assert(gem_buf);
+ }
+ else {
gem_buf = gem_mmap__cpu(drm_fd, handle, 0, buf_size, 0);
+ igt_assert(gem_buf);
+ }
igt_assert(wait_for_suspended());
@@ -1467,6 +1475,7 @@ static void fill_igt_fb(struct igt_fb *fb, uint32_t color)
uint32_t *ptr;
ptr = gem_mmap__gtt(drm_fd, fb->gem_handle, fb->size, PROT_WRITE);
+ igt_assert(ptr);
for (i = 0; i < fb->size/sizeof(uint32_t); i++)
ptr[i] = color;
igt_assert(munmap(ptr, fb->size) == 0);
@@ -1749,6 +1758,7 @@ static void fences_subtest(bool dpms)
buf_ptr = gem_mmap__gtt(drm_fd, params.fb.gem_handle,
params.fb.size, PROT_WRITE | PROT_READ);
+ igt_assert(buf_ptr);
for (i = 0; i < params.fb.size/sizeof(uint32_t); i++)
buf_ptr[i] = i;