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

Author: Faith Ekstrand <[email protected]>
Date:   Mon Oct 16 05:57:21 2023 -0500

nvk: Clean up the disk cache on physical device create fail path

Fixes: a4f8fd9dd53d ("nvk: Hook up the disk cache")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25749>

---

 src/nouveau/vulkan/nvk_physical_device.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/nouveau/vulkan/nvk_physical_device.c 
b/src/nouveau/vulkan/nvk_physical_device.c
index a6e2ba07a81..7f8faee1026 100644
--- a/src/nouveau/vulkan/nvk_physical_device.c
+++ b/src/nouveau/vulkan/nvk_physical_device.c
@@ -813,7 +813,7 @@ nvk_create_drm_physical_device(struct vk_instance 
*_instance,
    if (!os_get_available_system_memory(&sysmem_size_B)) {
       result = vk_errorf(instance, VK_ERROR_INITIALIZATION_FAILED,
                          "Failed to query available system memory");
-      goto fail_init;
+      goto fail_disk_cache;
    }
 
    if (pdev->info.vram_size_B) {
@@ -844,13 +844,14 @@ nvk_create_drm_physical_device(struct vk_instance 
*_instance,
 
    result = nvk_init_wsi(pdev);
    if (result != VK_SUCCESS)
-      goto fail_init;
+      goto fail_disk_cache;
 
    *pdev_out = &pdev->vk;
 
    return VK_SUCCESS;
 
-fail_init:
+fail_disk_cache:
+   nvk_physical_device_free_disk_cache(pdev);
    vk_physical_device_finish(&pdev->vk);
 fail_alloc:
    vk_free(&instance->vk.alloc, pdev);

Reply via email to