diff options
author | Emma Anholt <emma@anholt.net> | 2021-10-05 10:34:01 -0700 |
---|---|---|
committer | Marge Bot <eric+marge@anholt.net> | 2021-10-06 16:49:03 +0000 |
commit | 591afd1d52b37c8ec29c86e3e7900c11610bb64e (patch) | |
tree | 012a39b7c1d734f32bd33e6d2dda81abcef0c168 /src/freedreno/vulkan/tu_device.c | |
parent | 36d761f2a596e2033be89d74f49c4a1df17cbc79 (diff) |
turnip: Free disk cache on pdev init failure.
Noticed while debugging test failure under valgrind (the disk cache
doesn't come from the vulkan allocator, so we could leak it and not fail
the test).
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13200>
Diffstat (limited to 'src/freedreno/vulkan/tu_device.c')
-rw-r--r-- | src/freedreno/vulkan/tu_device.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/freedreno/vulkan/tu_device.c b/src/freedreno/vulkan/tu_device.c index 54f66c00d48..967c957a9e1 100644 --- a/src/freedreno/vulkan/tu_device.c +++ b/src/freedreno/vulkan/tu_device.c @@ -221,7 +221,7 @@ tu_physical_device_init(struct tu_physical_device *device, if (!info) { result = vk_startup_errorf(instance, VK_ERROR_INITIALIZATION_FAILED, "device %s is unsupported", device->name); - goto fail; + goto fail_free_name; } switch (fd_dev_gen(&device->dev_id)) { case 6: @@ -233,12 +233,12 @@ tu_physical_device_init(struct tu_physical_device *device, default: result = vk_startup_errorf(instance, VK_ERROR_INITIALIZATION_FAILED, "device %s is unsupported", device->name); - goto fail; + goto fail_free_name; } if (tu_device_get_cache_uuid(fd_dev_gpu_id(&device->dev_id), device->cache_uuid)) { result = vk_startup_errorf(instance, VK_ERROR_INITIALIZATION_FAILED, "cannot generate UUID"); - goto fail; + goto fail_free_name; } /* The gpu id is already embedded in the uuid so we just pass "tu" @@ -264,20 +264,22 @@ tu_physical_device_init(struct tu_physical_device *device, &supported_extensions, &dispatch_table); if (result != VK_SUCCESS) - goto fail; + goto fail_free_cache; #if TU_HAS_SURFACE result = tu_wsi_init(device); if (result != VK_SUCCESS) { vk_startup_errorf(instance, result, "WSI init failure"); vk_physical_device_finish(&device->vk); - goto fail; + goto fail_free_cache; } #endif return VK_SUCCESS; -fail: +fail_free_cache: + disk_cache_destroy(device->disk_cache); +fail_free_name: vk_free(&instance->vk.alloc, (void *)device->name); return result; } |