[PATCH] nvme-tcp-offload: Fix error code in nvme_tcp_ofld_create_ctrl()
Dan Carpenter
dan.carpenter at oracle.com
Wed Jun 9 02:28:31 PDT 2021
Return an error pointer if try_module_get() fails. Currently it returns
NULL.
Fixes: 4b8178ec5794 ("nvme-tcp-offload: Add device scan implementation")
Signed-off-by: Dan Carpenter <dan.carpenter at oracle.com>
---
drivers/nvme/host/tcp-offload.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/nvme/host/tcp-offload.c b/drivers/nvme/host/tcp-offload.c
index c76822e5ada7..c07f84a7e697 100644
--- a/drivers/nvme/host/tcp-offload.c
+++ b/drivers/nvme/host/tcp-offload.c
@@ -1215,7 +1215,7 @@ nvme_tcp_ofld_create_ctrl(struct device *ndev, struct nvmf_ctrl_options *opts)
/* Increase driver refcnt */
if (!try_module_get(dev->ops->module)) {
pr_err("try_module_get failed\n");
- dev = NULL;
+ rc = -ENODEV;
goto out_free_ctrl;
}
--
2.30.2
More information about the Linux-nvme
mailing list