Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Tvrtko Ursulin <tursulin@ursulin.net>
To: Intel-gfx@lists.freedesktop.org
Subject: [PATCH i-g-t] lib/igt_kms: Fix build warning in igt_display_drop_events
Date: Tue,  9 Jan 2018 12:47:04 +0000	[thread overview]
Message-ID: <20180109124704.4794-1-tvrtko.ursulin@linux.intel.com> (raw)

From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Check read(2) return for robustness and to silence gcc.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
--
Compile tested only.
---
 lib/igt_kms.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index ec3b716791a2..c8f30d2c8a54 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -3155,10 +3155,11 @@ int igt_display_drop_events(igt_display_t *display)
 		struct drm_event ev;
 		char buf[128];
 
-		read(display->drm_fd, &ev, sizeof(ev));
+		igt_assert_eq(read(display->drm_fd, &ev, sizeof(ev)),
+			      sizeof(ev));
 		igt_info("Dropping event type %u length %u\n", ev.type, ev.length);
 		igt_assert(ev.length <= sizeof(buf));
-		read(display->drm_fd, buf, ev.length);
+		igt_assert_eq(read(display->drm_fd, buf, ev.length), ev.length);
 		ret++;
 	}
 
-- 
2.14.1

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

             reply	other threads:[~2018-01-09 12:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-09 12:47 Tvrtko Ursulin [this message]
2018-01-09 13:51 ` ✓ Fi.CI.BAT: success for lib/igt_kms: Fix build warning in igt_display_drop_events Patchwork
2018-01-09 15:59 ` ✗ Fi.CI.IGT: failure " Patchwork
2018-01-10 17:46 ` [PATCH i-g-t] " 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=20180109124704.4794-1-tvrtko.ursulin@linux.intel.com \
    --to=tursulin@ursulin.net \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox