vk: Call vk_error when we generate a VK_ERROR
authorKristian Høgsberg Kristensen <krh@owl.jf.intel.com>
Mon, 4 Jan 2016 05:31:22 +0000 (21:31 -0800)
committerKristian Høgsberg Kristensen <krh@owl.jf.intel.com>
Mon, 4 Jan 2016 18:02:50 +0000 (10:02 -0800)
src/vulkan/anv_wsi_wayland.c

index d51a96b9f11bc504f812c5c6cb2d5d7a3ca24421..c9eb51012dc032b61635739cfec820f74e1bec85 100644 (file)
@@ -820,18 +820,20 @@ anv_wl_init_wsi(struct anv_instance *instance)
 
    wsi = anv_alloc(&instance->alloc, sizeof(*wsi), 8,
                    VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
-   if (!wsi)
-      return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
+   if (!wsi) {
+      result = vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
+      goto fail;
+   }
 
    wsi->instance = instance;
 
    int ret = pthread_mutex_init(&wsi->mutex, NULL);
    if (ret != 0) {
       if (ret == ENOMEM) {
-         result = VK_ERROR_OUT_OF_HOST_MEMORY;
+         result = vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
       } else {
          /* FINISHME: Choose a better error. */
-         result = VK_ERROR_OUT_OF_HOST_MEMORY;
+         result = vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
       }
 
       goto fail_alloc;
@@ -840,7 +842,7 @@ anv_wl_init_wsi(struct anv_instance *instance)
    wsi->displays = _mesa_hash_table_create(NULL, _mesa_hash_pointer,
                                            _mesa_key_pointer_equal);
    if (!wsi->displays) {
-      result = VK_ERROR_OUT_OF_HOST_MEMORY;
+      result = vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
       goto fail_mutex;
    }
 
@@ -853,6 +855,8 @@ fail_mutex:
 
 fail_alloc:
    anv_free(&instance->alloc, wsi);
+fail:
+   instance->wayland_wsi = NULL;
 
    return result;
 }