From 7dfac808b029a887023c2c24d08b408f517ce507 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Tue, 31 Aug 2021 12:36:45 -0700 Subject: [PATCH] venus: no supported device is not an error Signed-off-by: Chia-I Wu Reviewed-by: Ryan Neph Reviewed-by: Yiwei Zhang Part-of: --- src/virtio/vulkan/vn_physical_device.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/virtio/vulkan/vn_physical_device.c b/src/virtio/vulkan/vn_physical_device.c index 198356d..46bd8e5 100644 --- a/src/virtio/vulkan/vn_physical_device.c +++ b/src/virtio/vulkan/vn_physical_device.c @@ -1336,16 +1336,20 @@ vn_instance_enumerate_physical_devices(struct vn_instance *instance) } count = supported_count; - if (!count) - goto out; - - result = vn_instance_enumerate_physical_device_groups_locked( - instance, physical_devs, count); - if (result != VK_SUCCESS) { - for (uint32_t i = 0; i < count; i++) - vn_physical_device_fini(&physical_devs[i]); - count = 0; - goto out; + if (count) { + result = vn_instance_enumerate_physical_device_groups_locked( + instance, physical_devs, count); + if (result != VK_SUCCESS) { + for (uint32_t i = 0; i < count; i++) + vn_physical_device_fini(&physical_devs[i]); + count = 0; + goto out; + } + } else { + /* no supported physical device is not an error */ + result = VK_SUCCESS; + vk_free(alloc, physical_devs); + physical_devs = NULL; } instance->physical_device.devices = physical_devs; -- 2.7.4