From: Mohammed Khajapasha <mohammed.khajapasha@intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t 1/1] tests: update the test with close() for prime fd
Date: Thu, 9 Jan 2020 12:34:41 +0530 [thread overview]
Message-ID: <20200109070441.27511-2-mohammed.khajapasha@intel.com> (raw)
In-Reply-To: <20200109070441.27511-1-mohammed.khajapasha@intel.com>
Include close() for prime file descriptor and
call mumap() in mmap() success case only.
Signed-off-by: Mohammed Khajapasha <mohammed.khajapasha@intel.com>
---
tests/prime_mmap_kms.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/tests/prime_mmap_kms.c b/tests/prime_mmap_kms.c
index 29aec499..746e2abe 100644
--- a/tests/prime_mmap_kms.c
+++ b/tests/prime_mmap_kms.c
@@ -207,6 +207,9 @@ static void run_test(gpu_process_t *gpu)
igt_waitchildren();
igt_debug_wait_for_keypress("paint");
+
+ close(prime_fd);
+
cleanup_crtc(gpu);
/* once is enough */
@@ -227,11 +230,12 @@ check_for_dma_buf_mmap(int fd)
handle = gem_create(fd, 4096);
dma_buf_fd = prime_handle_to_fd(fd, handle);
ptr = mmap(NULL, 4096, PROT_READ, MAP_SHARED, dma_buf_fd, 0);
- if (ptr != MAP_FAILED)
+ if (ptr != MAP_FAILED) {
ret = 0;
- munmap(ptr, 4096);
- gem_close(fd, handle);
+ munmap(ptr, 4096);
+ }
close(dma_buf_fd);
+ gem_close(fd, handle);
return ret;
}
--
2.24.1
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
next prev parent reply other threads:[~2020-01-09 7:05 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-09 7:04 [igt-dev] [PATCH i-g-t 0/1] tests: update the test with close() for prime fd Mohammed Khajapasha
2020-01-09 7:04 ` Mohammed Khajapasha [this message]
2020-01-09 10:25 ` [igt-dev] [PATCH i-g-t 1/1] " Chris Wilson
2020-01-09 10:16 ` [igt-dev] ✓ Fi.CI.BAT: success for " Patchwork
2020-01-09 19:24 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200109070441.27511-2-mohammed.khajapasha@intel.com \
--to=mohammed.khajapasha@intel.com \
--cc=igt-dev@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox