[powerpc:next-test 179/194] arch/powerpc/platforms/pseries/eeh_pseries.c:420:6: error: variable 'ret' is used uninitialized whenever 'if' condition is true

kernel test robot lkp at intel.com
Fri Sep 25 09:33:25 AEST 2020


tree:   https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next-test
head:   2e60265c1feb6848c77dbea22d38bbe262ec49db
commit: b90e1cfa05bddc2fa0e314a790df603479259637 [179/194] powerpc/pseries/eeh: Rework device EEH PE determination
config: powerpc64-randconfig-r035-20200923 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project d6ac649ccda289ecc2d2c0cb51892d57e8ec328c)
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 powerpc64 cross compiling tool for clang build
        # apt-get install binutils-powerpc64-linux-gnu
        git checkout b90e1cfa05bddc2fa0e314a790df603479259637
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=powerpc64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp at intel.com>

All errors (new ones prefixed by >>):

   arch/powerpc/platforms/pseries/eeh_pseries.c:46:6: error: no previous prototype for function 'pseries_pcibios_bus_add_device' [-Werror,-Wmissing-prototypes]
   void pseries_pcibios_bus_add_device(struct pci_dev *pdev)
        ^
   arch/powerpc/platforms/pseries/eeh_pseries.c:46:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   void pseries_pcibios_bus_add_device(struct pci_dev *pdev)
   ^
   static 
>> arch/powerpc/platforms/pseries/eeh_pseries.c:420:6: error: variable 'ret' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
           if (addr == 0) {
               ^~~~~~~~~
   arch/powerpc/platforms/pseries/eeh_pseries.c:449:67: note: uninitialized use occurs here
           eeh_edev_dbg(edev, "EEH is unsupported on device (code = %d)\n", ret);
                                                                            ^~~
   arch/powerpc/include/asm/eeh.h:162:75: note: expanded from macro 'eeh_edev_dbg'
   #define eeh_edev_dbg(edev, fmt, ...) EEH_EDEV_PRINT(debug, (edev), fmt, ##__VA_ARGS__)
                                                                             ^~~~~~~~~~~
   arch/powerpc/include/asm/eeh.h:161:52: note: expanded from macro 'EEH_EDEV_PRINT'
           ((edev)->pe ? (edev)->pe_config_addr : 0xffff), ##__VA_ARGS__)
                                                             ^~~~~~~~~~~
   include/linux/printk.h:423:35: note: expanded from macro 'pr_debug'
           printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
                                            ^~~~~~~~~~~
   arch/powerpc/platforms/pseries/eeh_pseries.c:420:2: note: remove the 'if' if its condition is always false
           if (addr == 0) {
           ^~~~~~~~~~~~~~~~
   arch/powerpc/platforms/pseries/eeh_pseries.c:362:9: note: initialize the variable 'ret' to silence this warning
           int ret;
                  ^
                   = 0
   2 errors generated.

# https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/commit/?id=b90e1cfa05bddc2fa0e314a790df603479259637
git remote add powerpc https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git
git fetch --no-tags powerpc next-test
git checkout b90e1cfa05bddc2fa0e314a790df603479259637
vim +420 arch/powerpc/platforms/pseries/eeh_pseries.c

   345	
   346	/**
   347	 * pseries_eeh_init_edev - initialise the eeh_dev and eeh_pe for a pci_dn
   348	 *
   349	 * @pdn: PCI device node
   350	 *
   351	 * When we discover a new PCI device via the device-tree we create a
   352	 * corresponding pci_dn and we allocate, but don't initialise, an eeh_dev.
   353	 * This function takes care of the initialisation and inserts the eeh_dev
   354	 * into the correct eeh_pe. If no eeh_pe exists we'll allocate one.
   355	 */
   356	void pseries_eeh_init_edev(struct pci_dn *pdn)
   357	{
   358		struct eeh_pe pe, *parent;
   359		struct eeh_dev *edev;
   360		int addr;
   361		u32 pcie_flags;
   362		int ret;
   363	
   364		if (WARN_ON_ONCE(!eeh_has_flag(EEH_PROBE_MODE_DEVTREE)))
   365			return;
   366	
   367		/*
   368		 * Find the eeh_dev for this pdn. The storage for the eeh_dev was
   369		 * allocated at the same time as the pci_dn.
   370		 *
   371		 * XXX: We should probably re-visit that.
   372		 */
   373		edev = pdn_to_eeh_dev(pdn);
   374		if (!edev)
   375			return;
   376	
   377		/*
   378		 * If ->pe is set then we've already probed this device. We hit
   379		 * this path when a pci_dev is removed and rescanned while recovering
   380		 * a PE (i.e. for devices where the driver doesn't support error
   381		 * recovery).
   382		 */
   383		if (edev->pe)
   384			return;
   385	
   386		/* Check class/vendor/device IDs */
   387		if (!pdn->vendor_id || !pdn->device_id || !pdn->class_code)
   388			return;
   389	
   390		/* Skip for PCI-ISA bridge */
   391	        if ((pdn->class_code >> 8) == PCI_CLASS_BRIDGE_ISA)
   392			return;
   393	
   394		eeh_edev_dbg(edev, "Probing device\n");
   395	
   396		/*
   397		 * Update class code and mode of eeh device. We need
   398		 * correctly reflects that current device is root port
   399		 * or PCIe switch downstream port.
   400		 */
   401		edev->pcix_cap = pseries_eeh_find_cap(pdn, PCI_CAP_ID_PCIX);
   402		edev->pcie_cap = pseries_eeh_find_cap(pdn, PCI_CAP_ID_EXP);
   403		edev->aer_cap = pseries_eeh_find_ecap(pdn, PCI_EXT_CAP_ID_ERR);
   404		edev->mode &= 0xFFFFFF00;
   405		if ((pdn->class_code >> 8) == PCI_CLASS_BRIDGE_PCI) {
   406			edev->mode |= EEH_DEV_BRIDGE;
   407			if (edev->pcie_cap) {
   408				rtas_read_config(pdn, edev->pcie_cap + PCI_EXP_FLAGS,
   409						 2, &pcie_flags);
   410				pcie_flags = (pcie_flags & PCI_EXP_FLAGS_TYPE) >> 4;
   411				if (pcie_flags == PCI_EXP_TYPE_ROOT_PORT)
   412					edev->mode |= EEH_DEV_ROOT_PORT;
   413				else if (pcie_flags == PCI_EXP_TYPE_DOWNSTREAM)
   414					edev->mode |= EEH_DEV_DS_PORT;
   415			}
   416		}
   417	
   418		/* first up, find the pe_config_addr for the PE containing the device */
   419		addr = pseries_eeh_get_pe_config_addr(pdn);
 > 420		if (addr == 0) {
   421			eeh_edev_dbg(edev, "Unable to find pe_config_addr\n");
   422			goto err;
   423		}
   424	
   425		/* Try enable EEH on the fake PE */
   426		memset(&pe, 0, sizeof(struct eeh_pe));
   427		pe.phb = pdn->phb;
   428		pe.addr = addr;
   429	
   430		eeh_edev_dbg(edev, "Enabling EEH on device\n");
   431		ret = eeh_ops->set_option(&pe, EEH_OPT_ENABLE);
   432		if (ret) {
   433			eeh_edev_dbg(edev, "EEH failed to enable on device (code %d)\n", ret);
   434			goto err;
   435		}
   436	
   437		edev->pe_config_addr = addr;
   438	
   439		eeh_add_flag(EEH_ENABLED);
   440	
   441		parent = pseries_eeh_pe_get_parent(edev);
   442		eeh_pe_tree_insert(edev, parent);
   443		eeh_save_bars(edev);
   444		eeh_edev_dbg(edev, "EEH enabled for device");
   445	
   446		return;
   447	
   448	err:
   449		eeh_edev_dbg(edev, "EEH is unsupported on device (code = %d)\n", ret);
   450	}
   451	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 36095 bytes
Desc: not available
URL: <http://lists.ozlabs.org/pipermail/linuxppc-dev/attachments/20200925/32b9206f/attachment-0001.gz>


More information about the Linuxppc-dev mailing list