venus: Do not use instance pointer before NULL check

Fixes: a753f50668 ("venus: break up vn_device.c")
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Signed-off-by: Janne Grunau <j@jannau.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34613>
This commit is contained in:
Janne Grunau 2025-04-18 19:48:53 +02:00 committed by Marge Bot
parent 7d3a99a46c
commit 39e4fd98ce

View file

@ -409,12 +409,14 @@ vn_DestroyInstance(VkInstance _instance,
{
VN_TRACE_FUNC();
struct vn_instance *instance = vn_instance_from_handle(_instance);
const VkAllocationCallbacks *alloc =
pAllocator ? pAllocator : &instance->base.vk.alloc;
const VkAllocationCallbacks *alloc = pAllocator;
if (!instance)
return;
if (!alloc)
alloc = &instance->base.vk.alloc;
if (instance->physical_device.initialized) {
for (uint32_t i = 0; i < instance->physical_device.device_count; i++)
vn_physical_device_fini(&instance->physical_device.devices[i]);