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: Jim Harris <james.r.harris@intel.com> Change-Id: I49f09eff7c0908829819e6b797c922211c56e7db Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/10812 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com> Community-CI: Mellanox Build Bot Reviewed-by: Shuhei Matsumoto <smatsumoto@nvidia.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
This commit is contained in:
parent
61a640b2a6
commit
6a520ae644
@ -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,20 +57,20 @@ 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 (!spdk_nvme_cpl_is_error(&ctx->cpl)) {
|
||||
log_page = ctx->log_page;
|
||||
} else {
|
||||
/* We had an error, so don't return the log page to the caller. */
|
||||
log_page = NULL;
|
||||
free(ctx->log_page);
|
||||
}
|
||||
|
||||
ctx->cb_fn(ctx->cb_arg, 0, &ctx->cpl, log_page);
|
||||
free(ctx);
|
||||
if (ctx->outstanding_commands > 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!spdk_nvme_cpl_is_error(&ctx->cpl)) {
|
||||
log_page = ctx->log_page;
|
||||
} else {
|
||||
/* We had an error, so don't return the log page to the caller. */
|
||||
log_page = NULL;
|
||||
free(ctx->log_page);
|
||||
}
|
||||
|
||||
ctx->cb_fn(ctx->cb_arg, 0, &ctx->cpl, log_page);
|
||||
free(ctx);
|
||||
}
|
||||
|
||||
static void
|
||||
|
Loading…
Reference in New Issue
Block a user