c
static bool is_valid_pt_root(struct xe_vm *vm, u8 id)
{
    return vm && vm->pt_root && vm->pt_root[id] && 
           vm->pt_root[id]->bo && vm->pt_root[id]->bo->vmap;
}

// In the main function:
if (!is_valid_pt_root(vm, id)) {
    return -EINVAL;
}
xe_pt_write(xe, &vm->pt_root[id]->bo->vmap, 0, entry);
