nvme: Fix uninitialized-variable warning
authorKeith Busch <kbusch@kernel.org>
Wed, 19 Feb 2020 15:59:36 +0000 (00:59 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 11 Mar 2020 13:14:55 +0000 (14:14 +0100)
[ Upstream commit 15755854d53b4bbb0bb37a0fce66f0156cfc8a17 ]

gcc may detect a false positive on nvme using an unintialized variable
if setting features fails. Since this is not a fast path, explicitly
initialize this variable to suppress the warning.

Reported-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Keith Busch <kbusch@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/nvme/host/core.c

index f41fd15..a8132e8 100644 (file)
@@ -1058,8 +1058,8 @@ static struct nvme_id_ns *nvme_identify_ns(struct nvme_ctrl *ctrl,
 static int nvme_set_features(struct nvme_ctrl *dev, unsigned fid, unsigned dword11,
                      void *buffer, size_t buflen, u32 *result)
 {
+       union nvme_result res = { 0 };
        struct nvme_command c;
-       union nvme_result res;
        int ret;
 
        memset(&c, 0, sizeof(c));