diff --git a/src/imagination/vulkan/pvr_device.c b/src/imagination/vulkan/pvr_device.c index f52c9e98fb0..7e80e0d1979 100644 --- a/src/imagination/vulkan/pvr_device.c +++ b/src/imagination/vulkan/pvr_device.c @@ -812,18 +812,12 @@ static VkResult pvr_physical_device_init(struct pvr_physical_device *pdevice, VK_MEMORY_PROPERTY_HOST_COHERENT_BIT; pdevice->memory.memoryTypes[0].heapIndex = 0; - result = pvr_wsi_init(pdevice); - if (result != VK_SUCCESS) { - vk_error(instance, result); - goto err_free_pipeline_cache; - } - pdevice->compiler = rogue_compiler_create(&pdevice->dev_info); if (!pdevice->compiler) { result = vk_errorf(instance, VK_ERROR_INITIALIZATION_FAILED, "Failed to initialize Rogue compiler"); - goto err_wsi_finish; + goto err_free_pipeline_cache; } pdevice->pco_ctx = pco_ctx_create(&pdevice->dev_info, NULL); @@ -832,13 +826,22 @@ static VkResult pvr_physical_device_init(struct pvr_physical_device *pdevice, result = vk_errorf(instance, VK_ERROR_INITIALIZATION_FAILED, "Failed to initialize PCO compiler context"); - goto err_wsi_finish; + goto err_free_compiler; + } + + result = pvr_wsi_init(pdevice); + if (result != VK_SUCCESS) { + vk_error(instance, result); + goto err_free_pco_ctx; } return VK_SUCCESS; -err_wsi_finish: - pvr_wsi_finish(pdevice); +err_free_pco_ctx: + ralloc_free(pdevice->pco_ctx); + +err_free_compiler: + ralloc_free(pdevice->compiler); err_free_pipeline_cache: pvr_physical_device_free_pipeline_cache(pdevice);