Skip to content

Commit bd476c1

Browse files
nathanchancegregkh
authored andcommitted
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: b1c5f30 ("misc: rtsx: add rts5261 efuse function") Reported-by: Dan Carpenter <[email protected]> Reported-by: kernel test robot <[email protected]> Reported-by: Tom Rix <[email protected]> Suggested-by: Ricky WU <[email protected]> Acked-by: Arnd Bergmann <[email protected]> Signed-off-by: Nathan Chancellor <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 242439f commit bd476c1

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/misc/cardreader/rts5261.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,8 @@ static void rts5261_init_from_hw(struct rtsx_pcr *pcr)
407407
// default
408408
setting_reg1 = PCR_SETTING_REG1;
409409
setting_reg2 = PCR_SETTING_REG2;
410+
} else {
411+
return;
410412
}
411413

412414
pci_read_config_dword(pdev, setting_reg2, &lval2);

0 commit comments

Comments
 (0)