All of lore.kernel.org
 help / color / mirror / Atom feed
* [freescale-fslc:5.10-2.1.x-imx 1743/9999] drivers/pci/controller/dwc/pci-imx6.c:2938:29: warning: use of logical '&&' with constant operand
@ 2022-01-07 12:53 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2022-01-07 12:53 UTC (permalink / raw)
  To: kbuild-all

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

Hi Richard,

FYI, the error/warning still remains.

tree:   https://github.com/Freescale/linux-fslc 5.10-2.1.x-imx
head:   e730e691a1edb8c38004d81b070529224e8df714
commit: 1713c6ce909c5b8b54df3e9daa12d0e36eda86b7 [1743/9999] MLK-25283-4 PCI: imx: adjust the l1ss support to proper place
config: s390-randconfig-r044-20220107 (https://download.01.org/0day-ci/archive/20220107/202201072012.t1Lwxb9W-lkp(a)intel.com/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 32167bfe64a4c5dd4eb3f7a58e24f4cba76f5ac2)
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/Freescale/linux-fslc/commit/1713c6ce909c5b8b54df3e9daa12d0e36eda86b7
        git remote add freescale-fslc https://github.com/Freescale/linux-fslc
        git fetch --no-tags freescale-fslc 5.10-2.1.x-imx
        git checkout 1713c6ce909c5b8b54df3e9daa12d0e36eda86b7
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=s390 SHELL=/bin/bash drivers/pci/controller/dwc/

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/dwc/pci-imx6.c:15:
   In file included from include/linux/gpio.h:62:
   In file included from include/asm-generic/gpio.h:11:
   In file included from include/linux/gpio/driver.h:7:
   In file included from include/linux/irq.h:20:
   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/dwc/pci-imx6.c:15:
   In file included from include/linux/gpio.h:62:
   In file included from include/asm-generic/gpio.h:11:
   In file included from include/linux/gpio/driver.h:7:
   In file included from include/linux/irq.h:20:
   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/dwc/pci-imx6.c:15:
   In file included from include/linux/gpio.h:62:
   In file included from include/asm-generic/gpio.h:11:
   In file included from include/linux/gpio/driver.h:7:
   In file included from include/linux/irq.h:20:
   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/dwc/pci-imx6.c:2370:6: warning: unused variable 'reg' [-Wunused-variable]
           u32 reg;
               ^
>> drivers/pci/controller/dwc/pci-imx6.c:2938:29: warning: use of logical '&&' with constant operand [-Wconstant-logical-operand]
           if ((rc_l1sub && ep_l1sub) && PCI_L1SS_CAP_L1_PM_SS) {
                                      ^  ~~~~~~~~~~~~~~~~~~~~~
   drivers/pci/controller/dwc/pci-imx6.c:2938:29: note: use '&' for a bitwise operation
           if ((rc_l1sub && ep_l1sub) && PCI_L1SS_CAP_L1_PM_SS) {
                                      ^~
                                      &
   drivers/pci/controller/dwc/pci-imx6.c:2938:29: note: remove constant to silence this warning
           if ((rc_l1sub && ep_l1sub) && PCI_L1SS_CAP_L1_PM_SS) {
                                     ~^~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/pci/controller/dwc/pci-imx6.c:2902:11: warning: variable 'ret' set but not used [-Wunused-but-set-variable]
           int ttl, ret;
                    ^
   15 warnings generated.

Kconfig warnings: (for reference only)
   WARNING: unmet direct dependencies detected for INPUT_POLLDEV
   Depends on !UML && INPUT
   Selected by
   - MXC_MMA8451 && HWMON && I2C


vim +2938 drivers/pci/controller/dwc/pci-imx6.c

  2867	
  2868	static void imx6_pcie_quirk(struct pci_dev *dev)
  2869	{
  2870		struct pci_bus *bus = dev->bus;
  2871		struct pcie_port *pp = bus->sysdata;
  2872	
  2873		/* Bus parent is the PCI bridge, its parent is this platform driver */
  2874		if (!bus->dev.parent || !bus->dev.parent->parent)
  2875			return;
  2876	
  2877		/* Make sure we only quirk devices associated with this driver */
  2878		if (bus->dev.parent->parent->driver != &imx6_pcie_driver.driver)
  2879			return;
  2880	
  2881		if (pci_is_root_bus(bus)) {
  2882			struct dw_pcie *pci = to_dw_pcie_from_pp(pp);
  2883			struct imx6_pcie *imx6_pcie = to_imx6_pcie(pci);
  2884	
  2885			/*
  2886			 * Limit config length to avoid the kernel reading beyond
  2887			 * the register set and causing an abort on i.MX 6Quad
  2888			 */
  2889			if (imx6_pcie->drvdata->dbi_length) {
  2890				dev->cfg_size = imx6_pcie->drvdata->dbi_length;
  2891				dev_info(&dev->dev, "Limiting cfg_size to %d\n",
  2892						dev->cfg_size);
  2893			}
  2894		}
  2895	}
  2896	DECLARE_PCI_FIXUP_CLASS_HEADER(PCI_VENDOR_ID_SYNOPSYS, 0xabcd,
  2897				PCI_CLASS_BRIDGE_PCI, 8, imx6_pcie_quirk);
  2898	
  2899	static void imx6_pcie_l1ss_quirk(struct pci_dev *dev)
  2900	{
  2901		u32 reg, rc_l1sub, ep_l1sub, header;
> 2902		int ttl, ret;
  2903		int pos = PCI_CFG_SPACE_SIZE;
  2904		struct pci_bus *bus = dev->bus;
  2905		struct pcie_port *pp = bus->sysdata;
  2906		struct dw_pcie *pci = to_dw_pcie_from_pp(pp);
  2907		struct imx6_pcie *imx6_pcie = to_imx6_pcie(pci);
  2908	
  2909		/* Return directly, if the L1SS is not supported by RC */
  2910		if (!(imx6_pcie->drvdata->flags & IMX6_PCIE_FLAG_SUPPORTS_L1SS))
  2911			return;
  2912	
  2913		reg = dw_pcie_find_ext_capability(pci, PCI_EXT_CAP_ID_L1SS);
  2914		rc_l1sub = dw_pcie_readl_dbi(pci, reg + PCI_L1SS_CAP);
  2915	
  2916		/* minimum 8 bytes per capability */
  2917		ttl = (PCI_CFG_SPACE_EXP_SIZE - PCI_CFG_SPACE_SIZE) / 8;
  2918		ret = dw_pcie_read(pp->va_cfg0_base + pos, 4, &header);
  2919		/*
  2920		 * If we have no capabilities, this is indicated by cap ID,
  2921		 * cap version and next pointer all being 0.
  2922		 */
  2923		if (header == 0)
  2924			return;
  2925	
  2926		while (ttl-- > 0) {
  2927			if (PCI_EXT_CAP_ID(header) == PCI_EXT_CAP_ID_L1SS && pos != 0)
  2928				break;
  2929	
  2930			pos = PCI_EXT_CAP_NEXT(header);
  2931			if (pos < PCI_CFG_SPACE_SIZE)
  2932				break;
  2933	
  2934			ret = dw_pcie_read(pp->va_cfg0_base + pos, 4, &header);
  2935		}
  2936		ret = dw_pcie_read(pp->va_cfg0_base + pos + PCI_L1SS_CAP, 4, &ep_l1sub);
  2937	
> 2938		if ((rc_l1sub && ep_l1sub) && PCI_L1SS_CAP_L1_PM_SS) {
  2939			imx6_pcie->l1ss_clkreq = 1;
  2940			imx6_pcie_clkreq_enable(imx6_pcie);
  2941		} else {
  2942			imx6_pcie->l1ss_clkreq = 0;
  2943		}
  2944	}
  2945	DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_SYNOPSYS, 0xabcd, imx6_pcie_l1ss_quirk);
  2946	

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

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

only message in thread, other threads:[~2022-01-07 12:53 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-01-07 12:53 [freescale-fslc:5.10-2.1.x-imx 1743/9999] drivers/pci/controller/dwc/pci-imx6.c:2938:29: warning: use of logical '&&' with constant operand 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.