[pci:pci/err 11/16] drivers/pci/pcie/aer.c:1387:7: warning: variable 'rc' is used uninitialized whenever 'if' condition is false

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



tree:   https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git pci/err
head:   62a5549bfad79bd0bc6000edfdaaaf7049e8e6ce
commit: fdce092f478020e0e84b6743639d83a957e03ad1 [11/16] PCI/ERR: Recover from RCEC AER errors
config: x86_64-randconfig-r015-20201204 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 32c501dd88b62787d3a5ffda7aabcf4650dbe3cd)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install x86_64 cross compiling tool for clang build
        # apt-get install binutils-x86-64-linux-gnu
        # https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git/commit/?id=fdce092f478020e0e84b6743639d83a957e03ad1
        git remote add pci https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git
        git fetch --no-tags pci pci/err
        git checkout fdce092f478020e0e84b6743639d83a957e03ad1
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

>> drivers/pci/pcie/aer.c:1387:7: warning: variable 'rc' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
                   if (pcie_has_flr(dev)) {
                       ^~~~~~~~~~~~~~~~~
   drivers/pci/pcie/aer.c:1409:9: note: uninitialized use occurs here
           return rc ? PCI_ERS_RESULT_DISCONNECT : PCI_ERS_RESULT_RECOVERED;
                  ^~
   drivers/pci/pcie/aer.c:1387:3: note: remove the 'if' if its condition is always true
                   if (pcie_has_flr(dev)) {
                   ^~~~~~~~~~~~~~~~~~~~~~~
   drivers/pci/pcie/aer.c:1374:8: note: initialize the variable 'rc' to silence this warning
           int rc;
                 ^
                  = 0
   1 warning generated.

vim +1387 drivers/pci/pcie/aer.c

  1360	
  1361	/**
  1362	 * aer_root_reset - reset Root Port hierarchy or RCEC
  1363	 * @dev: pointer to Root Port or RCEC
  1364	 *
  1365	 * Invoked by Port Bus driver when performing reset.
  1366	 */
  1367	static pci_ers_result_t aer_root_reset(struct pci_dev *dev)
  1368	{
  1369		int type = pci_pcie_type(dev);
  1370		struct pci_dev *root;
  1371		int aer;
  1372		struct pci_host_bridge *host = pci_find_host_bridge(dev->bus);
  1373		u32 reg32;
  1374		int rc;
  1375	
  1376		root = dev;	/* device with Root Error registers */
  1377		aer = root->aer_cap;
  1378	
  1379		if ((host->native_aer || pcie_ports_native) && aer) {
  1380			/* Disable Root's interrupt in response to error messages */
  1381			pci_read_config_dword(root, aer + PCI_ERR_ROOT_COMMAND, &reg32);
  1382			reg32 &= ~ROOT_PORT_INTR_ON_MESG_MASK;
  1383			pci_write_config_dword(root, aer + PCI_ERR_ROOT_COMMAND, reg32);
  1384		}
  1385	
  1386		if (type == PCI_EXP_TYPE_RC_EC) {
> 1387			if (pcie_has_flr(dev)) {
  1388				rc = pcie_flr(dev);
  1389				pci_info(dev, "has been reset (%d)\n", rc);
  1390			} else {
  1391				pci_info(dev, "not reset (no FLR support)\n");
  1392			}
  1393		} else {
  1394			rc = pci_bus_error_reset(dev);
  1395			pci_info(dev, "Root Port link has been reset (%d)\n", rc);
  1396		}
  1397	
  1398		if ((host->native_aer || pcie_ports_native) && aer) {
  1399			/* Clear Root Error Status */
  1400			pci_read_config_dword(root, aer + PCI_ERR_ROOT_STATUS, &reg32);
  1401			pci_write_config_dword(root, aer + PCI_ERR_ROOT_STATUS, reg32);
  1402	
  1403			/* Enable Root Port's interrupt in response to error messages */
  1404			pci_read_config_dword(root, aer + PCI_ERR_ROOT_COMMAND, &reg32);
  1405			reg32 |= ROOT_PORT_INTR_ON_MESG_MASK;
  1406			pci_write_config_dword(root, aer + PCI_ERR_ROOT_COMMAND, reg32);
  1407		}
  1408	
  1409		return rc ? PCI_ERS_RESULT_DISCONNECT : PCI_ERS_RESULT_RECOVERED;
  1410	}
  1411	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux