Commit 5f523c44 authored by Shuhei Matsumoto's avatar Shuhei Matsumoto Committed by Tomasz Zawadzki
Browse files

bdev/nvme: Consolidate exit paths of connect_attach_cb()



Signed-off-by: default avatarShuhei 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: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-by: default avatarAleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent b2d785ee
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -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);

		spdk_nvme_detach(ctrlr);

		populate_namespaces_cb(ctx, 0, rc);
		return;
		goto exit;
	}

	rc = nvme_bdev_ctrlr_create(ctrlr, ctx->base_name, &ctx->trid, ctx->prchk_flags);
	if (rc) {
		SPDK_ERRLOG("Failed to create new device\n");
		populate_namespaces_cb(ctx, 0, rc);
		return;
		goto exit;
	}

	nvme_bdev_ctrlr = nvme_bdev_ctrlr_get(&ctx->trid);
	assert(nvme_bdev_ctrlr != NULL);

	nvme_ctrlr_populate_namespaces(nvme_bdev_ctrlr, ctx);
	return;

exit:
	populate_namespaces_cb(ctx, 0, rc);
}

static int