v3dv: use NULL for vk_error on initialization failures

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>
This commit is contained in:
Alejandro Piñeiro
2021-10-06 11:28:15 +02:00
parent ab1c888c8d
commit bc5892b7fc
+2 -2
View 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;