OSDN Git Service

anv/device: Return the right error for failed maps
[android-x86/external-mesa.git] / src / intel / vulkan / anv_gem.c
index a886f7c..0dde6d9 100644 (file)
@@ -21,8 +21,6 @@
  * IN THE SOFTWARE.
  */
 
-#define _DEFAULT_SOURCE
-
 #include <sys/ioctl.h>
 #include <sys/mman.h>
 #include <string.h>
@@ -90,10 +88,8 @@ anv_gem_mmap(struct anv_device *device, uint32_t gem_handle,
    };
 
    int ret = anv_ioctl(device->fd, DRM_IOCTL_I915_GEM_MMAP, &gem_mmap);
-   if (ret != 0) {
-      /* FIXME: Is NULL the right error return? Cf MAP_INVALID */
-      return NULL;
-   }
+   if (ret != 0)
+      return MAP_FAILED;
 
    VG(VALGRIND_MALLOCLIKE_BLOCK(gem_mmap.addr_ptr, gem_mmap.size, 0, 1));
    return (void *)(uintptr_t) gem_mmap.addr_ptr;