aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/nvme/target/discovery.c
diff options
context:
space:
mode:
authorMinwoo Im <minwoo.im.dev@gmail.com>2019-04-07 15:28:06 +0900
committerChristoph Hellwig <hch@lst.de>2019-04-25 16:41:26 +0200
commit6b7e631b927ca1266b2695307ab71ed7764af75e (patch)
treeb49449c54db621a11616b55ca66839a6afeb3988 /drivers/nvme/target/discovery.c
parentnvmet: rename nvme_completion instances from rsp to cqe (diff)
downloadlinux-dev-6b7e631b927ca1266b2695307ab71ed7764af75e.tar.xz
linux-dev-6b7e631b927ca1266b2695307ab71ed7764af75e.zip
nvmet: return a specified error it subsys_alloc fails
nvmet_subsys_alloc() returns its pointer or NULL if it fails. We can see three different steps in this function: 1. memory allocation 2. argument check 3. memory allocation for string But now the callers of this function do not seem to handle case 2 by returning -ENOMEM only even if it fails with an invalid parameter. This patch specifies error codes so that caller can pass it to its own caller. Signed-off-by: Minwoo Im <minwoo.im.dev@gmail.com> Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>. Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to '')
-rw-r--r--drivers/nvme/target/discovery.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/nvme/target/discovery.c b/drivers/nvme/target/discovery.c
index 33ed95e72d6b..e8e09266bfa5 100644
--- a/drivers/nvme/target/discovery.c
+++ b/drivers/nvme/target/discovery.c
@@ -372,8 +372,8 @@ int __init nvmet_init_discovery(void)
{
nvmet_disc_subsys =
nvmet_subsys_alloc(NVME_DISC_SUBSYS_NAME, NVME_NQN_DISC);
- if (!nvmet_disc_subsys)
- return -ENOMEM;
+ if (IS_ERR(nvmet_disc_subsys))
+ return PTR_ERR(nvmet_disc_subsys);
return 0;
}