提交 1367bc82 编写于 作者: W Wei Yongjun 提交者: Christoph Hellwig

nvmet: fix error return code in nvmet_file_ns_enable()

Fix to return error code -ENOMEM from the memory alloc fail error
handling case instead of 0, as done elsewhere in this function.

Fixes: d5eff33e ("nvmet: add simple file backed ns support")
Signed-off-by: NWei Yongjun <weiyongjun1@huawei.com>
Reviewed-by: NSagi Grimberg <sagi@grimberg.e>
Signed-off-by: NChristoph Hellwig <hch@lst.de>
上级 81cf54e0
......@@ -49,14 +49,18 @@ int nvmet_file_ns_enable(struct nvmet_ns *ns)
ns->bvec_cache = kmem_cache_create("nvmet-bvec",
NVMET_MAX_MPOOL_BVEC * sizeof(struct bio_vec),
0, SLAB_HWCACHE_ALIGN, NULL);
if (!ns->bvec_cache)
if (!ns->bvec_cache) {
ret = -ENOMEM;
goto err;
}
ns->bvec_pool = mempool_create(NVMET_MIN_MPOOL_OBJ, mempool_alloc_slab,
mempool_free_slab, ns->bvec_cache);
if (!ns->bvec_pool)
if (!ns->bvec_pool) {
ret = -ENOMEM;
goto err;
}
return ret;
err:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册