All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marius Vlad <marius.c.vlad@intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH i-g-t 1/2] tests/{kms_cursor_legacy, drv_missed_irq}, lib/drmtest: Fix warnings about unused function return values.
Date: Thu, 23 Jun 2016 19:46:02 +0300	[thread overview]
Message-ID: <1466700363-22009-1-git-send-email-marius.c.vlad@intel.com> (raw)

Signed-off-by: Marius Vlad <marius.c.vlad@intel.com>
CC: Chris Wilson <chris@chris-wilson.co.uk>
---
 lib/drmtest.c             | 8 +++-----
 tests/drv_missed_irq.c    | 2 +-
 tests/kms_cursor_legacy.c | 8 ++++++--
 3 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/lib/drmtest.c b/lib/drmtest.c
index 9a1232f..1e28f60 100644
--- a/lib/drmtest.c
+++ b/lib/drmtest.c
@@ -218,11 +218,11 @@ int drm_get_card(void)
 	return -1;
 }
 
-static void modprobe(const char *driver)
+static int modprobe(const char *driver)
 {
 	char buf[128];
 	snprintf(buf, sizeof(buf), "/sbin/modprobe -s %s", driver);
-	system(buf);
+	return system(buf);
 }
 
 /**
@@ -236,8 +236,6 @@ static void modprobe(const char *driver)
  */
 int __drm_open_driver(int chipset)
 {
-	if (chipset & DRIVER_VGEM)
-		modprobe("vgem");
 
 	for (int i = 0; i < 16; i++) {
 		char name[80];
@@ -258,7 +256,7 @@ int __drm_open_driver(int chipset)
 
 		if (chipset & DRIVER_VGEM &&
 		    is_vgem_device(fd))
-			return fd;
+			return (modprobe("vgem") == -1) ? -1 : fd;
 
 		close(fd);
 	}
diff --git a/tests/drv_missed_irq.c b/tests/drv_missed_irq.c
index 66d20ed..130a6aa 100644
--- a/tests/drv_missed_irq.c
+++ b/tests/drv_missed_irq.c
@@ -130,7 +130,7 @@ igt_simple_main
 	fclose(file);
 
 	file = igt_debugfs_fopen("i915_ring_test_irq", "r");
-	fscanf(file, "%x", &expect_rings);
+	igt_assert_eq(fscanf(file, "%x", &expect_rings), 1);
 	fclose(file);
 
 	igt_debug("Testing rings %x\n", expect_rings);
diff --git a/tests/kms_cursor_legacy.c b/tests/kms_cursor_legacy.c
index 00890c9..2228e99 100644
--- a/tests/kms_cursor_legacy.c
+++ b/tests/kms_cursor_legacy.c
@@ -238,6 +238,7 @@ static void flip(struct data *data,
 	}
 	igt_fork(child, 1) {
 		unsigned long count = 0;
+		ssize_t nread;
 		unsigned crtc = data->resources->crtcs[flip_pipe];
 
 		igt_until_timeout(timeout) {
@@ -245,7 +246,8 @@ static void flip(struct data *data,
 			drmModePageFlip(data->fd, crtc, fb_id,
 					DRM_MODE_PAGE_FLIP_EVENT,
 					NULL);
-			read(data->fd, buf, sizeof(buf));
+			nread = read(data->fd, buf, sizeof(buf));
+			igt_assert_eq(nread, sizeof(buf));
 			count++;
 		}
 
@@ -286,6 +288,7 @@ static void basic_flip(struct data *data)
 	struct igt_fb fb_info;
 	unsigned vblank_start;
 	int target;
+	ssize_t nread;
 	struct drm_event buf;
 	uint32_t fb_id;
 
@@ -338,7 +341,8 @@ static void basic_flip(struct data *data)
 	igt_assert_eq(get_vblank(data->fd, 0, 0), vblank_start);
 
 	igt_set_timeout(1, "Stuck page flip");
-	read(data->fd, &buf, sizeof(buf));
+	nread = read(data->fd, &buf, sizeof(buf));
+	igt_assert_eq(nread, sizeof(buf));
 	igt_assert_eq(get_vblank(data->fd, 0, 0), vblank_start + 1);
 	igt_reset_timeout();
 
-- 
2.5.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

             reply	other threads:[~2016-06-23 16:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-23 16:46 Marius Vlad [this message]
2016-06-23 16:46 ` [PATCH i-g-t 2/2] lib/drmtest: Report proper err message when opening the driver Marius Vlad
2016-06-23 19:54   ` Chris Wilson
2016-06-23 19:53 ` [PATCH i-g-t 1/2] tests/{kms_cursor_legacy, drv_missed_irq}, lib/drmtest: Fix warnings about unused function return values Chris Wilson

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=1466700363-22009-1-git-send-email-marius.c.vlad@intel.com \
    --to=marius.c.vlad@intel.com \
    --cc=intel-gfx@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.