[Intel-gfx] [PATCH i-g-t] lib/igt_kms: Fix build warning in igt_display_drop_events

Tvrtko Ursulin tursulin at ursulin.net
Tue Jan 9 12:47:04 UTC 2018


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

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

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
Cc: Maarten Lankhorst <maarten.lankhorst at 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



More information about the Intel-gfx mailing list