Skip to content

Commit 28c81c7

Browse files
r-barnesfacebook-github-bot
authored andcommitted
Fix missing field initializer in cachelib/navy/common/FdpNvme.cpp +1
Summary: The LLVM warning `-Wmissing-field-initializers` has found one or more structs in this diff's files which were missing field initializers. This can be unintended such as: ``` my_struct s1 = {0}; // Initializes *only* the first field to zero; others to default values my_struct s2 = {}; // Initializes *all* fields to default values (often zero) ``` or it may be because only some of the members of a struct are initialized, perhaps because the items were added to the struct but not every instance of it was updated. To fix the problem, I've either used `{}` to initialize all fields to default or added appropriate default initializations to the missing fields. - If you approve of this diff, please use the "Accept & Ship" button :-) Reviewed By: yfeldblum Differential Revision: D69753297 fbshipit-source-id: 98e0335038bd0125af4f03a43e67960c41ef3d8b
1 parent fa79d1a commit 28c81c7

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

cachelib/navy/common/FdpNvme.cpp

+8-9
Original file line numberDiff line numberDiff line change
@@ -88,15 +88,14 @@ int FdpNvme::nvmeIOMgmtRecv(uint32_t nsid,
8888
uint32_t cdw10 = (op & 0xf) | (op_specific & 0xff << 16);
8989
uint32_t cdw11 = (data_len >> 2) - 1; // cdw11 is 0 based
9090

91-
struct nvme_passthru_cmd cmd = {
92-
.opcode = nvme_cmd_io_mgmt_recv,
93-
.nsid = nsid,
94-
.addr = (uint64_t)(uintptr_t)data,
95-
.data_len = data_len,
96-
.cdw10 = cdw10,
97-
.cdw11 = cdw11,
98-
.timeout_ms = NVME_DEFAULT_IOCTL_TIMEOUT,
99-
};
91+
struct nvme_passthru_cmd cmd = {};
92+
cmd.opcode = nvme_cmd_io_mgmt_recv;
93+
cmd.nsid = nsid;
94+
cmd.addr = (uint64_t)(uintptr_t)data;
95+
cmd.data_len = data_len;
96+
cmd.cdw10 = cdw10;
97+
cmd.cdw11 = cdw11;
98+
cmd.timeout_ms = NVME_DEFAULT_IOCTL_TIMEOUT;
10099

101100
return ioctl(file_.fd(), NVME_IOCTL_IO_CMD, &cmd);
102101
}

0 commit comments

Comments
 (0)