c
static int init_mem_spinlock(struct io_tlb_mem *mem) {
    if (!mem) {
        pr_err("Error: mem is NULL\n");
        return -ENOMEM;
    }
    spin_lock_init(&mem->lock);
    return 0;
}

// Usage
int ret = init_mem_spinlock(mem);
if (ret) {
    // Handle error
    return ret;
}
