v3dv: use NULL for vk_error on initialization failures
authorAlejandro Piñeiro <apinheiro@igalia.com>
Wed, 6 Oct 2021 09:28:15 +0000 (11:28 +0200)
committerAlejandro Piñeiro <apinheiro@igalia.com>
Wed, 6 Oct 2021 09:42:28 +0000 (11:42 +0200)
This commit fixes two issues:

  * On CreateInstance, we are freeing the instance, and then trying to
    use it when calling vk_error. This could be problematic, so let's
    just use NULL.

  * On CreateDevice, we are getting a unsupported feature error, and
    then trying to call vk_error using the instance. That's is not
    really a instance error, and will assert when the ongoing common
    vk_error lands mesa. Let's use NULL instead, as the object it
    applies, the device, was not created.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13219>

src/broadcom/vulkan/v3dv_device.c

index ad06b97..f4e3fa4 100644 (file)
@@ -194,7 +194,7 @@ v3dv_CreateInstance(const VkInstanceCreateInfo *pCreateInfo,
 
    if (result != VK_SUCCESS) {
       vk_free(pAllocator, instance);
-      return vk_error(instance, result);
+      return vk_error(NULL, result);
    }
 
    v3d_process_debug_variable();
@@ -1754,7 +1754,7 @@ v3dv_CreateDevice(VkPhysicalDevice physicalDevice,
                            &dispatch_table, pCreateInfo, pAllocator);
    if (result != VK_SUCCESS) {
       vk_free(&device->vk.alloc, device);
-      return vk_error(instance, result);
+      return vk_error(NULL, result);
    }
 
    device->instance = instance;