From: Kristian Høgsberg Kristensen Date: Mon, 4 Jan 2016 05:31:22 +0000 (-0800) Subject: vk: Call vk_error when we generate a VK_ERROR X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3954594eb4385eef7cea606bc2bb0b92d19c1705;p=mesa.git vk: Call vk_error when we generate a VK_ERROR --- diff --git a/src/vulkan/anv_wsi_wayland.c b/src/vulkan/anv_wsi_wayland.c index d51a96b9f11..c9eb51012dc 100644 --- a/src/vulkan/anv_wsi_wayland.c +++ b/src/vulkan/anv_wsi_wayland.c @@ -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; }