Commit 280a3abc authored by Jim Harris's avatar Jim Harris
Browse files

nvmf: return early in nvmf_transport_poll_group_create



When buf_cache_size is 0, just return early.  This
allows us to un-indent a large section of code.

Signed-off-by: default avatarJim Harris <james.r.harris@intel.com>
Change-Id: I167da677fdcd0504c6f2bfdb8b1a818155642f66
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/17333


Community-CI: Mellanox Build Bot
Reviewed-by: default avatarAleksey Marchuk <alexeymar@nvidia.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
parent 2597ebbe
Loading
Loading
Loading
Loading
+27 −24
Original line number Diff line number Diff line
@@ -551,7 +551,11 @@ nvmf_transport_poll_group_create(struct spdk_nvmf_transport *transport,
	STAILQ_INIT(&tgroup->pending_buf_queue);
	STAILQ_INIT(&tgroup->buf_cache);

	if (transport->opts.buf_cache_size) {
	if (transport->opts.buf_cache_size == 0) {
		/* We aren't going to allocate any buffers for the cache, so just return now. */
		return tgroup;
	}

	tgroup->buf_cache_size = transport->opts.buf_cache_size;
	bufs = calloc(tgroup->buf_cache_size, sizeof(struct spdk_nvmf_transport_pg_cache_buf *));

@@ -580,7 +584,6 @@ nvmf_transport_poll_group_create(struct spdk_nvmf_transport *transport,
	tgroup->buf_cache_count = tgroup->buf_cache_size;

	free(bufs);
	}

	return tgroup;
}