Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

pm8001: Cleaning up uninitialized variables

There is a risk that the variable will be used without being initialized.

This was largely found by using a static code analysis program called cppche

Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
Acked-by: Suresh Thiagarajan <Suresh.Thiagarajan@pmcs.com>
Acked-by: Jack Wang <xjtuwjp@gmail.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>

authored by

Rickard Strandqvist and committed by
Christoph Hellwig
da225498 d9816446

+2 -4
+2 -4
drivers/scsi/pm8001/pm80xx_hwi.c
··· 952 952 pm80xx_get_encrypt_info(struct pm8001_hba_info *pm8001_ha) 953 953 { 954 954 u32 scratch3_value; 955 - int ret; 955 + int ret = -1; 956 956 957 957 /* Read encryption status from SCRATCH PAD 3 */ 958 958 scratch3_value = pm8001_cr32(pm8001_ha, 0, MSGU_SCRATCH_PAD_3); ··· 986 986 pm8001_ha->encrypt_info.status = 0xFFFFFFFF; 987 987 pm8001_ha->encrypt_info.cipher_mode = 0; 988 988 pm8001_ha->encrypt_info.sec_mode = 0; 989 - return 0; 989 + ret = 0; 990 990 } else if ((scratch3_value & SCRATCH_PAD3_ENC_MASK) == 991 991 SCRATCH_PAD3_ENC_DIS_ERR) { 992 992 pm8001_ha->encrypt_info.status = ··· 1008 1008 scratch3_value, pm8001_ha->encrypt_info.cipher_mode, 1009 1009 pm8001_ha->encrypt_info.sec_mode, 1010 1010 pm8001_ha->encrypt_info.status)); 1011 - ret = -1; 1012 1011 } else if ((scratch3_value & SCRATCH_PAD3_ENC_MASK) == 1013 1012 SCRATCH_PAD3_ENC_ENA_ERR) { 1014 1013 ··· 1031 1032 scratch3_value, pm8001_ha->encrypt_info.cipher_mode, 1032 1033 pm8001_ha->encrypt_info.sec_mode, 1033 1034 pm8001_ha->encrypt_info.status)); 1034 - ret = -1; 1035 1035 } 1036 1036 return ret; 1037 1037 }