nvk: Clean up try_create_physical_device error handling
authorFaith Ekstrand <faith.ekstrand@collabora.com>
Tue, 31 Jan 2023 02:11:54 +0000 (20:11 -0600)
committerMarge Bot <emma+marge@anholt.net>
Fri, 4 Aug 2023 21:31:57 +0000 (21:31 +0000)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>

src/nouveau/vulkan/nvk_physical_device.c

index 4160f4a..14eae6c 100644 (file)
@@ -346,10 +346,8 @@ nvk_physical_device_try_create(struct nvk_instance *instance,
                                     &supported_extensions, NULL,
                                     &dispatch_table);
 
-   if (result != VK_SUCCESS) {
-      vk_error(instance, result);
+   if (result != VK_SUCCESS)
       goto fail_alloc;
-   }
 
    device->instance = instance;
    device->dev = ndev;
@@ -384,19 +382,18 @@ nvk_physical_device_try_create(struct nvk_instance *instance,
    device->vk.supported_sync_types = device->sync_types;
 
    result = nvk_init_wsi(device);
-   if (result != VK_SUCCESS) {
-      vk_error(instance, result);
-      goto fail_alloc;
-   }
+   if (result != VK_SUCCESS)
+      goto fail_init;
 
    *device_out = device;
 
    close(fd);
    return VK_SUCCESS;
 
+fail_init:
+   vk_physical_device_finish(&device->vk);
 fail_alloc:
    vk_free(&instance->vk.alloc, device);
-
 fail_dev_alloc:
    nouveau_ws_device_destroy(ndev);
    return result;