From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paulo Zanoni Subject: [PATCH 2/2] drmtest: assert operations inside gem_mmap__cpu Date: Fri, 8 Nov 2013 18:50:23 -0200 Message-ID: <1383943823-5061-2-git-send-email-przanoni@gmail.com> References: <1383943823-5061-1-git-send-email-przanoni@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail-qe0-f53.google.com (mail-qe0-f53.google.com [209.85.128.53]) by gabe.freedesktop.org (Postfix) with ESMTP id 55873FB816 for ; Fri, 8 Nov 2013 12:50:37 -0800 (PST) Received: by mail-qe0-f53.google.com with SMTP id cy11so2416321qeb.40 for ; Fri, 08 Nov 2013 12:50:36 -0800 (PST) In-Reply-To: <1383943823-5061-1-git-send-email-przanoni@gmail.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org To: intel-gfx@lists.freedesktop.org Cc: Paulo Zanoni List-Id: intel-gfx@lists.freedesktop.org From: Paulo Zanoni All the callers seem to rely on the correct behavior of gem_mmap__cpu, so add some assertions to catch the unexpected cases. This way we won't need to worry about adding assertions to all the callers. Signed-off-by: Paulo Zanoni --- lib/drmtest.c | 4 ++-- tests/gem_fence_thrash.c | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/drmtest.c b/lib/drmtest.c index 636ba26..6ac9354 100644 --- a/lib/drmtest.c +++ b/lib/drmtest.c @@ -564,8 +564,8 @@ void *gem_mmap__cpu(int fd, uint32_t handle, int size) mmap_arg.handle = handle; mmap_arg.offset = 0; mmap_arg.size = size; - if (drmIoctl(fd, DRM_IOCTL_I915_GEM_MMAP, &mmap_arg)) - return NULL; + do_ioctl(fd, DRM_IOCTL_I915_GEM_MMAP, &mmap_arg); + igt_assert(mmap_arg.addr_ptr); return (void *)(uintptr_t)mmap_arg.addr_ptr; } diff --git a/tests/gem_fence_thrash.c b/tests/gem_fence_thrash.c index 8e16f21..ced9b13 100644 --- a/tests/gem_fence_thrash.c +++ b/tests/gem_fence_thrash.c @@ -69,7 +69,6 @@ bo_create (int fd, int tiling) /* dirty cpu caches a bit ... */ ptr = gem_mmap__cpu(fd, handle, OBJECT_SIZE); - igt_assert(ptr); memset(ptr, 0, OBJECT_SIZE); munmap(ptr, OBJECT_SIZE); -- 1.8.3.1