[PATCH 1/2] drm: drmIoctl return -errno on failure conditions

Ben Widawsky ben at bwidawsk.net
Wed Jun 6 16:41:17 PDT 2012


Anyone aware of what this will break? It seems to be a much nicer thing
to do for callers. If people do not like it, I will probably just create
a #define drmIoctl2 or some such thing.

Cc: Daniel Vetter <daniel.vetter at ffwll.ch>
Cc: Keith Packard <keithp at keithp.com>
Signed-off-by: Ben Widawsky <ben at bwidawsk.net>
---
 xf86drm.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/xf86drm.c b/xf86drm.c
index 6ea068f..015203d 100644
--- a/xf86drm.c
+++ b/xf86drm.c
@@ -166,6 +166,10 @@ drmIoctl(int fd, unsigned long request, void *arg)
     do {
 	ret = ioctl(fd, request, arg);
     } while (ret == -1 && (errno == EINTR || errno == EAGAIN));
+
+    if (ret)
+	return -errno;
+
     return ret;
 }
 
-- 
1.7.10.3



More information about the dri-devel mailing list