Skip to content

Commit 8cdb368

Browse files
elmarcophilmd
authored andcommitted
hw/nvme: fix -Werror=maybe-uninitialized
../hw/nvme/ctrl.c:6081:21: error: ‘result’ may be used uninitialized [-Werror=maybe-uninitialized] It's not obvious that 'result' is set in all code paths. When &result is a returned argument, it's even less clear. Looking at various assignments, 0 seems to be a suitable default value. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Klaus Jensen <k.jensen@samsung.com> Message-ID: <20240328102052.3499331-18-marcandre.lureau@redhat.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
1 parent c65288d commit 8cdb368

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

hw/nvme/ctrl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5894,7 +5894,7 @@ static uint16_t nvme_get_feature(NvmeCtrl *n, NvmeRequest *req)
58945894
uint32_t dw10 = le32_to_cpu(cmd->cdw10);
58955895
uint32_t dw11 = le32_to_cpu(cmd->cdw11);
58965896
uint32_t nsid = le32_to_cpu(cmd->nsid);
5897-
uint32_t result;
5897+
uint32_t result = 0;
58985898
uint8_t fid = NVME_GETSETFEAT_FID(dw10);
58995899
NvmeGetFeatureSelect sel = NVME_GETFEAT_SELECT(dw10);
59005900
uint16_t iv;

0 commit comments

Comments
 (0)