Mesa (main): venus: fix a missing mtx_destroy in vn_device_init

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Jun 16 19:06:12 UTC 2022


Module: Mesa
Branch: main
Commit: cf55a3f70e1c64b05ce3d9117cfa19dde68eefc7
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=cf55a3f70e1c64b05ce3d9117cfa19dde68eefc7

Author: Yiwei Zhang <zzyiwei at chromium.org>
Date:   Thu May 19 20:56:08 2022 +0000

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 at chromium.org>
Reviewed-by: Chad Versace <chadversary at chromium.org>
Reviewed-by: Ryan Neph <ryanneph at google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16731>

---

 src/virtio/vulkan/vn_device.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/src/virtio/vulkan/vn_device.c b/src/virtio/vulkan/vn_device.c
index 6e04afbd4a0..b71d0f5eea0 100644
--- a/src/virtio/vulkan/vn_device.c
+++ b/src/virtio/vulkan/vn_device.c
@@ -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;



More information about the mesa-commit mailing list