nvk: Clean up the disk cache on physical device create fail path
authorFaith Ekstrand <faith.ekstrand@collabora.com>
Mon, 16 Oct 2023 10:57:21 +0000 (05:57 -0500)
committerFaith Ekstrand <faith.ekstrand@collabora.com>
Mon, 16 Oct 2023 10:58:58 +0000 (05:58 -0500)
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

index a6e2ba07a819c74b88a4eca98b5dcca12137fac8..7f8faee102610dab79d9ad6d577aa51a7fcc8eff 100644 (file)
@@ -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);