venus: fix a missing mtx_destroy in vn_device_init

This was introduced in commit e08960482, however, the logic around has
been largly refactored since then. It's not worth adding the fixes tag.

Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Chad Versace <chadversary@chromium.org>
Reviewed-by: Ryan Neph <ryanneph@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16731>
This commit is contained in:
Yiwei Zhang 2022-05-19 20:56:08 +00:00 committed by Marge Bot
parent cb8dfa4966
commit cf55a3f70e

View file

@ -293,7 +293,7 @@ vn_device_init(struct vn_device *dev,
result = vn_device_init_queues(dev, create_info); result = vn_device_init_queues(dev, create_info);
if (result != VK_SUCCESS) if (result != VK_SUCCESS)
goto fail; goto out_destroy_device;
for (uint32_t i = 0; i < ARRAY_SIZE(dev->memory_pools); i++) { for (uint32_t i = 0; i < ARRAY_SIZE(dev->memory_pools); i++) {
struct vn_device_memory_pool *pool = &dev->memory_pools[i]; struct vn_device_memory_pool *pool = &dev->memory_pools[i];
@ -302,18 +302,19 @@ vn_device_init(struct vn_device *dev,
result = vn_buffer_cache_init(dev); result = vn_buffer_cache_init(dev);
if (result != VK_SUCCESS) if (result != VK_SUCCESS)
goto fail; goto out_memory_pool_fini;
return VK_SUCCESS; return VK_SUCCESS;
fail: out_memory_pool_fini:
if (dev->queues) { for (uint32_t i = 0; i < ARRAY_SIZE(dev->memory_pools); i++)
for (uint32_t i = 0; i < dev->queue_count; i++) vn_device_memory_pool_fini(dev, i);
vn_queue_fini(&dev->queues[i]);
vk_free(alloc, dev->queues); for (uint32_t i = 0; i < dev->queue_count; i++)
} vn_queue_fini(&dev->queues[i]);
vk_free(alloc, dev->queues);
out_destroy_device:
vn_call_vkDestroyDevice(instance, dev_handle, NULL); vn_call_vkDestroyDevice(instance, dev_handle, NULL);
return result; return result;