Ejemplo n.º 1
0
static int __init tcm_loop_fabric_init(void)
{
    int ret;

    tcm_loop_cmd_cache = kmem_cache_create("tcm_loop_cmd_cache",
                                           sizeof(struct tcm_loop_cmd),
                                           __alignof__(struct tcm_loop_cmd),
                                           0, NULL);
    if (!tcm_loop_cmd_cache) {
        pr_debug("kmem_cache_create() for"
                 " tcm_loop_cmd_cache failed\n");
        return -ENOMEM;
    }

    ret = tcm_loop_alloc_core_bus();
    if (ret)
        return ret;

    ret = tcm_loop_register_configfs();
    if (ret) {
        tcm_loop_release_core_bus();
        return ret;
    }

    return 0;
}
Ejemplo n.º 2
0
static int __init tcm_loop_fabric_init(void)
{
	int ret = -ENOMEM;

	tcm_loop_workqueue = alloc_workqueue("tcm_loop", 0, 0);
	if (!tcm_loop_workqueue)
		goto out;

	tcm_loop_cmd_cache = kmem_cache_create("tcm_loop_cmd_cache",
				sizeof(struct tcm_loop_cmd),
				__alignof__(struct tcm_loop_cmd),
				0, NULL);
	if (!tcm_loop_cmd_cache) {
		pr_debug("kmem_cache_create() for"
			" tcm_loop_cmd_cache failed\n");
		goto out_destroy_workqueue;
	}

	ret = tcm_loop_alloc_core_bus();
	if (ret)
		goto out_destroy_cache;

	ret = tcm_loop_register_configfs();
	if (ret)
		goto out_release_core_bus;

	return 0;

out_release_core_bus:
	tcm_loop_release_core_bus();
out_destroy_cache:
	kmem_cache_destroy(tcm_loop_cmd_cache);
out_destroy_workqueue:
	destroy_workqueue(tcm_loop_workqueue);
out:
	return ret;
}