提交 bd476c13 编写于 作者: N Nathan Chancellor 提交者: Greg Kroah-Hartman

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: b1c5f308 ("misc: rtsx: add rts5261 efuse function")
Reported-by: NDan Carpenter <dan.carpenter@oracle.com>
Reported-by: Nkernel test robot <lkp@intel.com>
Reported-by: NTom Rix <trix@redhat.com>
Suggested-by: NRicky WU <ricky_wu@realtek.com>
Acked-by: NArnd Bergmann <arnd@arndb.de>
Signed-off-by: NNathan Chancellor <nathan@kernel.org>
Link: https://lore.kernel.org/r/20220523150521.2947108-1-nathan@kernel.orgSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 242439f7
...@@ -407,6 +407,8 @@ static void rts5261_init_from_hw(struct rtsx_pcr *pcr) ...@@ -407,6 +407,8 @@ static void rts5261_init_from_hw(struct rtsx_pcr *pcr)
// default // default
setting_reg1 = PCR_SETTING_REG1; setting_reg1 = PCR_SETTING_REG1;
setting_reg2 = PCR_SETTING_REG2; setting_reg2 = PCR_SETTING_REG2;
} else {
return;
} }
pci_read_config_dword(pdev, setting_reg2, &lval2); pci_read_config_dword(pdev, setting_reg2, &lval2);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册