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
1 changed files with 9 additions and 8 deletions

View File

@ -293,7 +293,7 @@ vn_device_init(struct vn_device *dev,
result = vn_device_init_queues(dev, create_info);
if (result != VK_SUCCESS)
goto fail;
goto out_destroy_device;
for (uint32_t i = 0; i < ARRAY_SIZE(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);
if (result != VK_SUCCESS)
goto fail;
goto out_memory_pool_fini;
return VK_SUCCESS;
fail:
if (dev->queues) {
for (uint32_t i = 0; i < dev->queue_count; i++)
vn_queue_fini(&dev->queues[i]);
out_memory_pool_fini:
for (uint32_t i = 0; i < ARRAY_SIZE(dev->memory_pools); i++)
vn_device_memory_pool_fini(dev, 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);
return result;