Ported from anv:
3d33a23e anv: Properly handle destroying NULL devices and instances
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
{
RADV_FROM_HANDLE(radv_instance, instance, _instance);
+ if (!instance)
+ return;
+
for (int i = 0; i < instance->physicalDeviceCount; ++i) {
radv_physical_device_finish(instance->physicalDevices + i);
}
{
RADV_FROM_HANDLE(radv_device, device, _device);
+ if (!device)
+ return;
+
if (device->trace_bo)
device->ws->buffer_destroy(device->trace_bo);