ctrl->cap |= NVMET_QUEUE_SIZE - 1;
 }
 
-u16 nvmet_ctrl_find_get(const char *subsysnqn, const char *hostnqn, u16 cntlid,
-               struct nvmet_req *req, struct nvmet_ctrl **ret)
+struct nvmet_ctrl *nvmet_ctrl_find_get(const char *subsysnqn,
+                                      const char *hostnqn, u16 cntlid,
+                                      struct nvmet_req *req)
 {
+       struct nvmet_ctrl *ctrl = NULL;
        struct nvmet_subsys *subsys;
-       struct nvmet_ctrl *ctrl;
-       u16 status = 0;
 
        subsys = nvmet_find_get_subsys(req->port, subsysnqn);
        if (!subsys) {
                pr_warn("connect request for invalid subsystem %s!\n",
                        subsysnqn);
                req->cqe->result.u32 = IPO_IATTR_CONNECT_DATA(subsysnqn);
-               return NVME_SC_CONNECT_INVALID_PARAM | NVME_SC_DNR;
+               goto out;
        }
 
        mutex_lock(&subsys->lock);
                        if (!kref_get_unless_zero(&ctrl->ref))
                                continue;
 
-                       *ret = ctrl;
-                       goto out;
+                       /* ctrl found */
+                       goto found;
                }
        }
 
+       ctrl = NULL; /* ctrl not found */
        pr_warn("could not find controller %d for subsys %s / host %s\n",
                cntlid, subsysnqn, hostnqn);
        req->cqe->result.u32 = IPO_IATTR_CONNECT_DATA(cntlid);
-       status = NVME_SC_CONNECT_INVALID_PARAM | NVME_SC_DNR;
 
-out:
+found:
        mutex_unlock(&subsys->lock);
        nvmet_subsys_put(subsys);
-       return status;
+out:
+       return ctrl;
 }
 
 u16 nvmet_check_ctrl_status(struct nvmet_req *req)
 
 {
        struct nvmf_connect_command *c = &req->cmd->connect;
        struct nvmf_connect_data *d;
-       struct nvmet_ctrl *ctrl = NULL;
+       struct nvmet_ctrl *ctrl;
        u16 qid = le16_to_cpu(c->qid);
        u16 status = 0;
 
                goto out;
        }
 
-       status = nvmet_ctrl_find_get(d->subsysnqn, d->hostnqn,
-                                    le16_to_cpu(d->cntlid),
-                                    req, &ctrl);
-       if (status)
+       ctrl = nvmet_ctrl_find_get(d->subsysnqn, d->hostnqn,
+                                  le16_to_cpu(d->cntlid), req);
+       if (!ctrl) {
+               status = NVME_SC_CONNECT_INVALID_PARAM | NVME_SC_DNR;
                goto out;
+       }
 
        if (unlikely(qid > ctrl->subsys->max_qid)) {
                pr_warn("invalid queue id (%d)\n", qid);
 
 void nvmet_update_cc(struct nvmet_ctrl *ctrl, u32 new);
 u16 nvmet_alloc_ctrl(const char *subsysnqn, const char *hostnqn,
                struct nvmet_req *req, u32 kato, struct nvmet_ctrl **ctrlp);
-u16 nvmet_ctrl_find_get(const char *subsysnqn, const char *hostnqn, u16 cntlid,
-               struct nvmet_req *req, struct nvmet_ctrl **ret);
+struct nvmet_ctrl *nvmet_ctrl_find_get(const char *subsysnqn,
+                                      const char *hostnqn, u16 cntlid,
+                                      struct nvmet_req *req);
 void nvmet_ctrl_put(struct nvmet_ctrl *ctrl);
 u16 nvmet_check_ctrl_status(struct nvmet_req *req);