summaryrefslogtreecommitdiff
path: root/drivers/nvme
diff options
context:
space:
mode:
authorWei Yongjun <weiyongjun1@huawei.com>2018-05-31 11:41:30 +0000
committerChristoph Hellwig <hch@lst.de>2018-05-31 18:46:46 +0200
commit1367bc82858018fd1a5a81b8fad4628e7163d1bf (patch)
treea56ba69f7fd73ceb73a6cdca58c2dbaa01e77184 /drivers/nvme
parent81cf54e01a3d2eb47bee78a7579fc4dd0912f347 (diff)
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: d5eff33ee6f8 ("nvmet: add simple file backed ns support") Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com> Reviewed-by: Sagi Grimberg <sagi@grimberg.e> Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'drivers/nvme')
-rw-r--r--drivers/nvme/target/io-cmd-file.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/nvme/target/io-cmd-file.c b/drivers/nvme/target/io-cmd-file.c
index 9cff553caa1f..8c42b3a8c420 100644
--- a/drivers/nvme/target/io-cmd-file.c
+++ b/drivers/nvme/target/io-cmd-file.c
@@ -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: