From 79c75a3e973ff491e5d1c1957433634e9d90d933 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Wed, 7 Sep 2022 18:41:48 -0700 Subject: [PATCH] turnip: fix error handling for tu_queue_init tu_queue_finish can only be called on initialized queues. Part-of: --- src/freedreno/vulkan/tu_device.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/freedreno/vulkan/tu_device.c b/src/freedreno/vulkan/tu_device.c index 992a6c9053c..2f76ae222f5 100644 --- a/src/freedreno/vulkan/tu_device.c +++ b/src/freedreno/vulkan/tu_device.c @@ -1856,8 +1856,10 @@ tu_CreateDevice(VkPhysicalDevice physicalDevice, for (unsigned q = 0; q < queue_create->queueCount; q++) { result = tu_queue_init(device, &device->queues[qfi][q], q, queue_create); - if (result != VK_SUCCESS) + if (result != VK_SUCCESS) { + device->queue_count[qfi] = q; goto fail_queues; + } } } @@ -2056,7 +2058,7 @@ fail_queues: for (unsigned i = 0; i < TU_MAX_QUEUE_FAMILIES; i++) { for (unsigned q = 0; q < device->queue_count[i]; q++) tu_queue_finish(&device->queues[i][q]); - if (device->queue_count[i]) + if (device->queues[i]) vk_free(&device->vk.alloc, device->queues[i]); }