blob: 1b103ba78f1b99881c2778d94ba31c190083083d [file] [log] [blame]
From cd5a19c0e7ce6b1d0ab4ff91ece20f15f5de1511 Mon Sep 17 00:00:00 2001
From: Keith Busch <kbusch@kernel.org>
Date: Thu, 20 Feb 2020 00:59:36 +0900
Subject: [PATCH] nvme: Fix uninitialized-variable warning
commit 15755854d53b4bbb0bb37a0fce66f0156cfc8a17 upstream.
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: Paul Gortmaker <paul.gortmaker@windriver.com>
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 30c9560e71d0..c36e71d97e0c 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -1126,8 +1126,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));
--
2.7.4