Commit 6a520ae6 authored by Jim Harris's avatar Jim Harris Committed by Tomasz Zawadzki
Browse files

nvme: simplify get_log_page_completion



Return if outstanding_commands > 0. This reduces
indentation for the rest of the code in the
function and simplifies the diff for an upcoming
patch.

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


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: default avatarShuhei Matsumoto <smatsumoto@nvidia.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
parent 61a640b2
Loading
Loading
Loading
Loading
+13 −12
Original line number Diff line number Diff line
@@ -48,6 +48,7 @@ static void
get_log_page_completion(void *cb_arg, const struct spdk_nvme_cpl *cpl)
{
	struct nvme_discovery_ctx *ctx = cb_arg;
	struct spdk_nvmf_discovery_log_page *log_page;

	if (spdk_nvme_cpl_is_error(cpl)) {
		/* Only save the cpl for the first error that we encounter. */
@@ -56,8 +57,9 @@ get_log_page_completion(void *cb_arg, const struct spdk_nvme_cpl *cpl)
		}
	}
	ctx->outstanding_commands--;
	if (ctx->outstanding_commands == 0) {
		struct spdk_nvmf_discovery_log_page *log_page;
	if (ctx->outstanding_commands > 0) {
		return;
	}

	if (!spdk_nvme_cpl_is_error(&ctx->cpl)) {
		log_page = ctx->log_page;
@@ -70,7 +72,6 @@ get_log_page_completion(void *cb_arg, const struct spdk_nvme_cpl *cpl)
	ctx->cb_fn(ctx->cb_arg, 0, &ctx->cpl, log_page);
	free(ctx);
}
}

static void
discovery_log_header_completion(void *cb_arg, const struct spdk_nvme_cpl *cpl)