All of lore.kernel.org
 help / color / mirror / Atom feed
* [frank-w-bpi-r2-4.14:5.12-rc 25/28] drivers/pci/controller/pcie-mediatek.c:1072:3: warning: variable 'child' is used uninitialized whenever 'if' condition is true
@ 2021-03-24 18:17 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2021-03-24 18:17 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 9003 bytes --]

tree:   https://github.com/frank-w/BPI-R2-4.14 5.12-rc
head:   a274b03ce7a694aa026d66d7a1f855b0a1021fec
commit: 7375bbfd405f43557966d0710d0d019f1e290634 [25/28] PCI: mediatek: Add new method to get shared pcie-cfg base address and parse node
config: s390-randconfig-r036-20210324 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project a4fb88669cd98db6fef7dcac88e3ec425d40c00d)
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 s390 cross compiling tool for clang build
        # apt-get install binutils-s390x-linux-gnu
        # https://github.com/frank-w/BPI-R2-4.14/commit/7375bbfd405f43557966d0710d0d019f1e290634
        git remote add frank-w-bpi-r2-4.14 https://github.com/frank-w/BPI-R2-4.14
        git fetch --no-tags frank-w-bpi-r2-4.14 5.12-rc
        git checkout 7375bbfd405f43557966d0710d0d019f1e290634
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=s390 

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

All warnings (new ones prefixed by >>):

   In file included from drivers/pci/controller/pcie-mediatek.c:12:
   In file included from include/linux/iopoll.h:14:
   In file included from include/linux/io.h:13:
   In file included from arch/s390/include/asm/io.h:80:
   include/asm-generic/io.h:464:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           val = __raw_readb(PCI_IOBASE + addr);
                             ~~~~~~~~~~ ^
   include/asm-generic/io.h:477:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr));
                                                           ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/big_endian.h:36:59: note: expanded from macro '__le16_to_cpu'
   #define __le16_to_cpu(x) __swab16((__force __u16)(__le16)(x))
                                                             ^
   include/uapi/linux/swab.h:102:54: note: expanded from macro '__swab16'
   #define __swab16(x) (__u16)__builtin_bswap16((__u16)(x))
                                                        ^
   In file included from drivers/pci/controller/pcie-mediatek.c:12:
   In file included from include/linux/iopoll.h:14:
   In file included from include/linux/io.h:13:
   In file included from arch/s390/include/asm/io.h:80:
   include/asm-generic/io.h:490:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
                                                           ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/big_endian.h:34:59: note: expanded from macro '__le32_to_cpu'
   #define __le32_to_cpu(x) __swab32((__force __u32)(__le32)(x))
                                                             ^
   include/uapi/linux/swab.h:115:54: note: expanded from macro '__swab32'
   #define __swab32(x) (__u32)__builtin_bswap32((__u32)(x))
                                                        ^
   In file included from drivers/pci/controller/pcie-mediatek.c:12:
   In file included from include/linux/iopoll.h:14:
   In file included from include/linux/io.h:13:
   In file included from arch/s390/include/asm/io.h:80:
   include/asm-generic/io.h:501:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           __raw_writeb(value, PCI_IOBASE + addr);
                               ~~~~~~~~~~ ^
   include/asm-generic/io.h:511:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
                                                         ~~~~~~~~~~ ^
   include/asm-generic/io.h:521:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
                                                         ~~~~~~~~~~ ^
   include/asm-generic/io.h:609:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           readsb(PCI_IOBASE + addr, buffer, count);
                  ~~~~~~~~~~ ^
   include/asm-generic/io.h:617:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           readsw(PCI_IOBASE + addr, buffer, count);
                  ~~~~~~~~~~ ^
   include/asm-generic/io.h:625:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           readsl(PCI_IOBASE + addr, buffer, count);
                  ~~~~~~~~~~ ^
   include/asm-generic/io.h:634:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           writesb(PCI_IOBASE + addr, buffer, count);
                   ~~~~~~~~~~ ^
   include/asm-generic/io.h:643:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           writesw(PCI_IOBASE + addr, buffer, count);
                   ~~~~~~~~~~ ^
   include/asm-generic/io.h:652:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           writesl(PCI_IOBASE + addr, buffer, count);
                   ~~~~~~~~~~ ^
>> drivers/pci/controller/pcie-mediatek.c:1072:3: warning: variable 'child' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
                   if (err)
                   ^~~~~~~~
   include/linux/compiler.h:56:28: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/compiler.h:58:30: note: expanded from macro '__trace_if_var'
   #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/pci/controller/pcie-mediatek.c:1090:14: note: uninitialized use occurs here
           of_node_put(child);
                       ^~~~~
   drivers/pci/controller/pcie-mediatek.c:1072:3: note: remove the 'if' if its condition is always false
                   if (err)
                   ^~~~~~~~
   include/linux/compiler.h:56:23: note: expanded from macro 'if'
   #define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
                         ^
   drivers/pci/controller/pcie-mediatek.c:1051:49: note: initialize the variable 'child' to silence this warning
           struct device_node *node = dev->of_node, *child;
                                                          ^
                                                           = NULL
   13 warnings generated.


vim +1072 drivers/pci/controller/pcie-mediatek.c

  1047	
  1048	static int mtk_pcie_setup(struct mtk_pcie *pcie)
  1049	{
  1050		struct device *dev = pcie->dev;
  1051		struct device_node *node = dev->of_node, *child;
  1052		struct mtk_pcie_port *port, *tmp;
  1053		int err, slot;
  1054	
  1055		slot = of_get_pci_domain_nr(dev->of_node);
  1056		if (slot < 0) {
  1057			for_each_available_child_of_node(node, child) {
  1058				err = of_pci_get_devfn(child);
  1059				if (err < 0) {
  1060					dev_err(dev, "failed to get devfn: %d\n", err);
  1061					goto error_put_node;
  1062				}
  1063	
  1064				slot = PCI_SLOT(err);
  1065	
  1066				err = mtk_pcie_parse_port(pcie, child, slot);
  1067				if (err)
  1068					goto error_put_node;
  1069			}
  1070		} else {
  1071			err = mtk_pcie_parse_port(pcie, node, slot);
> 1072			if (err)
  1073				goto error_put_node;
  1074		}
  1075	
  1076		err = mtk_pcie_subsys_powerup(pcie);
  1077		if (err)
  1078			return err;
  1079	
  1080		/* enable each port, and then check link status */
  1081		list_for_each_entry_safe(port, tmp, &pcie->ports, list)
  1082			mtk_pcie_enable_port(port);
  1083	
  1084		/* power down PCIe subsys if slots are all empty (link down) */
  1085		if (list_empty(&pcie->ports))
  1086			mtk_pcie_subsys_powerdown(pcie);
  1087	
  1088		return 0;
  1089	error_put_node:
  1090		of_node_put(child);
  1091		return err;
  1092	}
  1093	

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

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 41909 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-03-24 18:17 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-24 18:17 [frank-w-bpi-r2-4.14:5.12-rc 25/28] drivers/pci/controller/pcie-mediatek.c:1072:3: warning: variable 'child' is used uninitialized whenever 'if' condition is true kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.