[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220523150521.2947108-1-nathan@kernel.org>
Date: Mon, 23 May 2022 08:05:22 -0700
From: Nathan Chancellor <nathan@...nel.org>
To: Arnd Bergmann <arnd@...db.de>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: Nick Desaulniers <ndesaulniers@...gle.com>,
linux-kernel@...r.kernel.org, llvm@...ts.linux.dev,
patches@...ts.linux.dev, Nathan Chancellor <nathan@...nel.org>,
Dan Carpenter <dan.carpenter@...cle.com>,
kernel test robot <lkp@...el.com>, Tom Rix <trix@...hat.com>,
Ricky WU <ricky_wu@...ltek.com>
Subject: [PATCH] misc: rtsx: Fix clang -Wsometimes-uninitialized in rts5261_init_from_hw()
Clang warns:
drivers/misc/cardreader/rts5261.c:406:13: error: variable 'setting_reg2' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
} else if (efuse_valid == 0) {
^~~~~~~~~~~~~~~~
drivers/misc/cardreader/rts5261.c:412:30: note: uninitialized use occurs here
pci_read_config_dword(pdev, setting_reg2, &lval2);
^~~~~~~~~~~~
efuse_valid == 1 is not a valid value so just return early from the
function to avoid using setting_reg2 uninitialized.
Fixes: b1c5f3085149 ("misc: rtsx: add rts5261 efuse function")
Reported-by: Dan Carpenter <dan.carpenter@...cle.com>
Reported-by: kernel test robot <lkp@...el.com>
Reported-by: Tom Rix <trix@...hat.com>
Suggested-by: Ricky WU <ricky_wu@...ltek.com>
Signed-off-by: Nathan Chancellor <nathan@...nel.org>
---
This is basically a v2 of https://lore.kernel.org/20220516130047.3887590-1-trix@redhat.com/.
drivers/misc/cardreader/rts5261.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/misc/cardreader/rts5261.c b/drivers/misc/cardreader/rts5261.c
index 749cc5a46d13..b1e76030cafd 100644
--- a/drivers/misc/cardreader/rts5261.c
+++ b/drivers/misc/cardreader/rts5261.c
@@ -407,6 +407,8 @@ static void rts5261_init_from_hw(struct rtsx_pcr *pcr)
// default
setting_reg1 = PCR_SETTING_REG1;
setting_reg2 = PCR_SETTING_REG2;
+ } else {
+ return;
}
pci_read_config_dword(pdev, setting_reg2, &lval2);
base-commit: 90de6805267f8c79cd2b1a36805071e257c39b5c
--
2.36.1
Powered by blists - more mailing lists