minigbm: Fix consistency in return values
minigbm functions don't use errno; however drmIoctl does. So we need
to return -errno instead of returning exactly what drmIoctl returns.
BUG=none
TEST=builds
Change-Id: I20e00141782ac1407133ee72259fe43381954d26
Reviewed-on: https://chromium-review.googlesource.com/1534878
Commit-Ready: Stéphane Marchesin <marcheu@chromium.org>
Tested-by: Stéphane Marchesin <marcheu@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
diff --git a/mediatek.c b/mediatek.c
index 59a0fac..5edb629 100644
--- a/mediatek.c
+++ b/mediatek.c
@@ -7,6 +7,7 @@
#ifdef DRV_MEDIATEK
// clang-format off
+#include <errno.h>
#include <fcntl.h>
#include <poll.h>
#include <stdio.h>
@@ -81,7 +82,7 @@
ret = drmIoctl(bo->drv->fd, DRM_IOCTL_MTK_GEM_CREATE, &gem_create);
if (ret) {
drv_log("DRM_IOCTL_MTK_GEM_CREATE failed (size=%llu)\n", gem_create.size);
- return ret;
+ return -errno;
}
for (plane = 0; plane < bo->num_planes; plane++)