for (int family = 0; family < RADV_MAX_QUEUE_FAMILIES; ++family) {
                device->empty_cs[family] = device->ws->cs_create(device->ws, family);
+               if (!device->empty_cs[family])
+                       goto fail;
+
                switch (family) {
                case RADV_QUEUE_GENERAL:
                        radeon_emit(device->empty_cs[family], PKT3(PKT3_CONTEXT_CONTROL, 1, 0));
                        radeon_emit(device->empty_cs[family], 0);
                        break;
                }
-               device->ws->cs_finalize(device->empty_cs[family]);
+
+               result = device->ws->cs_finalize(device->empty_cs[family]);
+               if (result != VK_SUCCESS)
+                       goto fail;
        }
 
        if (device->physical_device->rad_info.chip_class >= GFX7)
 
        struct radv_timeline_point *ret = NULL;
        struct radv_timeline_point *prev = NULL;
+       int r;
 
        if (p <= timeline->highest_signaled)
                return NULL;
 
        if (list_is_empty(&timeline->free_points)) {
                ret = malloc(sizeof(struct radv_timeline_point));
-               device->ws->create_syncobj(device->ws, false, &ret->syncobj);
+               r = device->ws->create_syncobj(device->ws, false, &ret->syncobj);
+               if (r) {
+                       free(ret);
+                       return NULL;
+               }
        } else {
                ret = list_first_entry(&timeline->free_points, struct radv_timeline_point, list);
                list_del(&ret->list);
 
 radv_thread_trace_init_cs(struct radv_device *device)
 {
        struct radeon_winsys *ws = device->ws;
+       VkResult result;
 
        /* Thread trace start CS. */
        for (int family = 0; family < 2; ++family) {
                device->thread_trace_start_cs[family] = ws->cs_create(ws, family);
+               if (!device->thread_trace_start_cs[family])
+                       return;
+
                switch (family) {
                case RADV_QUEUE_GENERAL:
                        radeon_emit(device->thread_trace_start_cs[family], PKT3(PKT3_CONTEXT_CONTROL, 1, 0));
                                             device->thread_trace_start_cs[family],
                                             family);
 
-               ws->cs_finalize(device->thread_trace_start_cs[family]);
+               result = ws->cs_finalize(device->thread_trace_start_cs[family]);
+               if (result != VK_SUCCESS)
+                       return;
        }
 
        /* Thread trace stop CS. */
        for (int family = 0; family < 2; ++family) {
                device->thread_trace_stop_cs[family] = ws->cs_create(ws, family);
+               if (!device->thread_trace_stop_cs[family])
+                       return;
+
                switch (family) {
                case RADV_QUEUE_GENERAL:
                        radeon_emit(device->thread_trace_stop_cs[family], PKT3(PKT3_CONTEXT_CONTROL, 1, 0));
                                          device->thread_trace_stop_cs[family],
                                          false);
 
-               ws->cs_finalize(device->thread_trace_stop_cs[family]);
+               result = ws->cs_finalize(device->thread_trace_stop_cs[family]);
+               if (result != VK_SUCCESS)
+                       return;
        }
 }