nvme_pcie_common: Move group right before using.
Better not to cache a value especially for there's an error return. Signed-off-by: yidong0635 <dongx.yi@intel.com> Change-Id: I3b243a66f4db9af34bc2ea01bafdac33004be128 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/13650 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com> Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
This commit is contained in:
parent
510f4c134a
commit
b813f998ea
@ -1791,13 +1791,13 @@ nvme_pcie_poll_group_get_stats(struct spdk_nvme_transport_poll_group *tgroup,
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
group = SPDK_CONTAINEROF(tgroup, struct nvme_pcie_poll_group, group);
|
|
||||||
stats = calloc(1, sizeof(*stats));
|
stats = calloc(1, sizeof(*stats));
|
||||||
if (!stats) {
|
if (!stats) {
|
||||||
SPDK_ERRLOG("Can't allocate memory for RDMA stats\n");
|
SPDK_ERRLOG("Can't allocate memory for RDMA stats\n");
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
stats->trtype = SPDK_NVME_TRANSPORT_PCIE;
|
stats->trtype = SPDK_NVME_TRANSPORT_PCIE;
|
||||||
|
group = SPDK_CONTAINEROF(tgroup, struct nvme_pcie_poll_group, group);
|
||||||
memcpy(&stats->pcie, &group->stats, sizeof(group->stats));
|
memcpy(&stats->pcie, &group->stats, sizeof(group->stats));
|
||||||
|
|
||||||
*_stats = stats;
|
*_stats = stats;
|
||||||
|
Loading…
Reference in New Issue
Block a user