test/nvme_poll_group: Fix uninitialized value in unittest.

Compiling with warning:
nvme_poll_group_ut.c: In function ‘test_spdk_nvme_poll_group_add_remove’:
nvme_poll_group_ut.c:268:8: warning: ‘tgroup’ may be used uninitialized
in this function [-Wmaybe-uninitialized]
  qpair = STAILQ_FIRST(&tgroup->active_qpairs);

tgroup may can't be initialized as:
                if (tmp_tgroup->transport == &t1) {
                        tgroup = tmp_tgroup;
                } else {
                        CU_ASSERT(STAILQ_EMPTY(&tmp_tgroup->active_qpairs));
                }

Signed-off-by: yidong0635 <dongx.yi@intel.com>
Change-Id: Id915e651f73ca3814a7e8d3f95c8793b8b880990
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1738
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
This commit is contained in:
yidong0635 2020-04-08 08:01:42 -04:00 committed by Tomasz Zawadzki
parent a91d650245
commit 97e345002b

View File

@ -229,7 +229,8 @@ static void
test_spdk_nvme_poll_group_add_remove(void)
{
struct spdk_nvme_poll_group *group;
struct spdk_nvme_transport_poll_group *tgroup, *tmp_tgroup, *tgroup_1 = NULL, *tgroup_2 = NULL,
struct spdk_nvme_transport_poll_group *tgroup = NULL, *tmp_tgroup, *tgroup_1 = NULL,
*tgroup_2 = NULL,
*tgroup_4 = NULL;
struct spdk_nvme_qpair *qpair;
struct spdk_nvme_qpair qpair1_1 = {0};