Commit 97e34500 authored by yidong0635's avatar yidong0635 Committed by Tomasz Zawadzki
Browse files

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: default avataryidong0635 <dongx.yi@intel.com>
Change-Id: Id915e651f73ca3814a7e8d3f95c8793b8b880990
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1738


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: default avatarDarek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: default avatarAleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: default avatarPaul Luse <paul.e.luse@intel.com>
parent a91d6502
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -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};