bdev/nvme: Consolidate exit paths of connect_attach_cb()
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Change-Id: Ife0bc6575697dee5a470793361502a852b132191 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5651 Community-CI: Broadcom CI Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
b2d785ee48
commit
5f523c44f0
@ -1923,22 +1923,23 @@ connect_attach_cb(void *cb_ctx, const struct spdk_nvme_transport_id *trid,
|
|||||||
rc = bdev_nvme_add_trid(nvme_bdev_ctrlr, ctrlr, &ctx->trid);
|
rc = bdev_nvme_add_trid(nvme_bdev_ctrlr, ctrlr, &ctx->trid);
|
||||||
|
|
||||||
spdk_nvme_detach(ctrlr);
|
spdk_nvme_detach(ctrlr);
|
||||||
|
goto exit;
|
||||||
populate_namespaces_cb(ctx, 0, rc);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = nvme_bdev_ctrlr_create(ctrlr, ctx->base_name, &ctx->trid, ctx->prchk_flags);
|
rc = nvme_bdev_ctrlr_create(ctrlr, ctx->base_name, &ctx->trid, ctx->prchk_flags);
|
||||||
if (rc) {
|
if (rc) {
|
||||||
SPDK_ERRLOG("Failed to create new device\n");
|
SPDK_ERRLOG("Failed to create new device\n");
|
||||||
populate_namespaces_cb(ctx, 0, rc);
|
goto exit;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nvme_bdev_ctrlr = nvme_bdev_ctrlr_get(&ctx->trid);
|
nvme_bdev_ctrlr = nvme_bdev_ctrlr_get(&ctx->trid);
|
||||||
assert(nvme_bdev_ctrlr != NULL);
|
assert(nvme_bdev_ctrlr != NULL);
|
||||||
|
|
||||||
nvme_ctrlr_populate_namespaces(nvme_bdev_ctrlr, ctx);
|
nvme_ctrlr_populate_namespaces(nvme_bdev_ctrlr, ctx);
|
||||||
|
return;
|
||||||
|
|
||||||
|
exit:
|
||||||
|
populate_namespaces_cb(ctx, 0, rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
Loading…
Reference in New Issue
Block a user