UT/NVMe: Fix compilation warnings

Fix warning: missing braces around initializer

This issue is seen with gcc (GCC) 4.8.5 20150623.

Warning like below:

nvme_tcp_ut.c:243:9: warning: (near initialization for ‘ctrlr.ns’) [-Wmissing-braces]
nvme_tcp_ut.c: In function ‘test_nvme_tcp_req_init’:
nvme_tcp_ut.c:525:9: warning: missing braces around initializer [-Wmissing-braces]
  struct spdk_nvme_ctrlr ctrlr = {0};
         ^
nvme_tcp_ut.c:525:9: warning: (near initialization for ‘ctrlr.ns’) [-Wmissing-braces]

And more information from below link:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53119

Change-Id: I88b5b3908d5d0daa9383e47a1ed53288f342ca3b
Signed-off-by: GangCao <gang.cao@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/11137
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Shuhei Matsumoto <smatsumoto@nvidia.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
This commit is contained in:
GangCao 2022-01-18 19:03:39 -05:00 committed by Tomasz Zawadzki
parent b04f51ac62
commit 7b67a696da
4 changed files with 7 additions and 7 deletions

View File

@ -2266,7 +2266,7 @@ test_nvme_ctrlr_init_delay(void)
static void
test_spdk_nvme_ctrlr_set_trid(void)
{
struct spdk_nvme_ctrlr ctrlr = {0};
struct spdk_nvme_ctrlr ctrlr = {{0}};
struct spdk_nvme_transport_id new_trid = {{0}};
CU_ASSERT(pthread_mutex_init(&ctrlr.ctrlr_lock, NULL) == 0);

View File

@ -594,7 +594,7 @@ static void
test_nvme_ns_cmd_write_zeroes(void)
{
struct spdk_nvme_ns ns = { 0 };
struct spdk_nvme_ctrlr ctrlr = { 0 };
struct spdk_nvme_ctrlr ctrlr = {{0}};
struct spdk_nvme_qpair qpair;
spdk_nvme_cmd_cb cb_fn = NULL;
void *cb_arg = NULL;
@ -621,7 +621,7 @@ static void
test_nvme_ns_cmd_write_uncorrectable(void)
{
struct spdk_nvme_ns ns = { 0 };
struct spdk_nvme_ctrlr ctrlr = { 0 };
struct spdk_nvme_ctrlr ctrlr = {{0}};
struct spdk_nvme_qpair qpair;
spdk_nvme_cmd_cb cb_fn = NULL;
void *cb_arg = NULL;

View File

@ -179,7 +179,7 @@ static void test_nvme_qpair_process_completions(void)
{
struct spdk_nvme_qpair admin_qp = {0};
struct spdk_nvme_qpair qpair = {0};
struct spdk_nvme_ctrlr ctrlr = {0};
struct spdk_nvme_ctrlr ctrlr = {{0}};
struct nvme_request dummy_1 = {{0}};
struct nvme_request dummy_2 = {{0}};
int rc;

View File

@ -240,7 +240,7 @@ static void
test_nvme_tcp_build_sgl_request(void)
{
struct nvme_tcp_qpair tqpair;
struct spdk_nvme_ctrlr ctrlr = {0};
struct spdk_nvme_ctrlr ctrlr = {{0}};
struct nvme_tcp_req tcp_req = {0};
struct nvme_request req = {{0}};
struct nvme_tcp_ut_bdev_io bio;
@ -522,7 +522,7 @@ test_nvme_tcp_req_init(void)
struct nvme_tcp_qpair tqpair = {};
struct nvme_request req = {};
struct nvme_tcp_req tcp_req = {0};
struct spdk_nvme_ctrlr ctrlr = {0};
struct spdk_nvme_ctrlr ctrlr = {{0}};
struct nvme_tcp_ut_bdev_io bio = {};
int rc;