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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxx>

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

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxx>
Cc: Maarten Lankhorst <maarten.lankhorst@xxxxxxxxxxxxxxx>
--
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@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux