Hi Oleksij,

I love your patch! Perhaps something to improve:

[auto build test WARNING on net-next/master]

url:    
https://github.com/0day-ci/linux/commits/Oleksij-Rempel/ar9331-mainline-some-parts-of-switch-functionality/20210403-195131
base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 
82506665179209e43d3c9d39ffa42f8c8ff968bd
config: powerpc-randconfig-r035-20210403 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 
0fe8af94688aa03c01913c2001d6a1a911f42ce6)
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 powerpc cross compiling tool for clang build
        # apt-get install binutils-powerpc-linux-gnu
        # 
https://github.com/0day-ci/linux/commit/1d06a86ebc7af4decbdf92e3114a6d983063eca1
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review 
Oleksij-Rempel/ar9331-mainline-some-parts-of-switch-functionality/20210403-195131
        git checkout 1d06a86ebc7af4decbdf92e3114a6d983063eca1
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=powerpc 

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

All warnings (new ones prefixed by >>):

   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/powerpc/include/asm/io.h:619:
   arch/powerpc/include/asm/io-defs.h:43:1: warning: performing pointer 
arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
   DEF_PCI_AC_NORET(insb, (unsigned long p, void *b, unsigned long c),
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/powerpc/include/asm/io.h:616:3: note: expanded from macro 
'DEF_PCI_AC_NORET'
                   __do_##name al;                                 \
                   ^~~~~~~~~~~~~~
   <scratch space>:97:1: note: expanded from here
   __do_insb
   ^
   arch/powerpc/include/asm/io.h:556:56: note: expanded from macro '__do_insb'
   #define __do_insb(p, b, n)      readsb((PCI_IO_ADDR)_IO_BASE+(p), (b), (n))
                                          ~~~~~~~~~~~~~~~~~~~~~^
   In file included from drivers/net/dsa/qca/ar9331.c:44:
   In file included from include/linux/of_irq.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/powerpc/include/asm/io.h:619:
   arch/powerpc/include/asm/io-defs.h:45:1: warning: performing pointer 
arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
   DEF_PCI_AC_NORET(insw, (unsigned long p, void *b, unsigned long c),
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/powerpc/include/asm/io.h:616:3: note: expanded from macro 
'DEF_PCI_AC_NORET'
                   __do_##name al;                                 \
                   ^~~~~~~~~~~~~~
   <scratch space>:99:1: note: expanded from here
   __do_insw
   ^
   arch/powerpc/include/asm/io.h:557:56: note: expanded from macro '__do_insw'
   #define __do_insw(p, b, n)      readsw((PCI_IO_ADDR)_IO_BASE+(p), (b), (n))
                                          ~~~~~~~~~~~~~~~~~~~~~^
   In file included from drivers/net/dsa/qca/ar9331.c:44:
   In file included from include/linux/of_irq.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/powerpc/include/asm/io.h:619:
   arch/powerpc/include/asm/io-defs.h:47:1: warning: performing pointer 
arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
   DEF_PCI_AC_NORET(insl, (unsigned long p, void *b, unsigned long c),
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/powerpc/include/asm/io.h:616:3: note: expanded from macro 
'DEF_PCI_AC_NORET'
                   __do_##name al;                                 \
                   ^~~~~~~~~~~~~~
   <scratch space>:101:1: note: expanded from here
   __do_insl
   ^
   arch/powerpc/include/asm/io.h:558:56: note: expanded from macro '__do_insl'
   #define __do_insl(p, b, n)      readsl((PCI_IO_ADDR)_IO_BASE+(p), (b), (n))
                                          ~~~~~~~~~~~~~~~~~~~~~^
   In file included from drivers/net/dsa/qca/ar9331.c:44:
   In file included from include/linux/of_irq.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/powerpc/include/asm/io.h:619:
   arch/powerpc/include/asm/io-defs.h:49:1: warning: performing pointer 
arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
   DEF_PCI_AC_NORET(outsb, (unsigned long p, const void *b, unsigned long c),
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/powerpc/include/asm/io.h:616:3: note: expanded from macro 
'DEF_PCI_AC_NORET'
                   __do_##name al;                                 \
                   ^~~~~~~~~~~~~~
   <scratch space>:103:1: note: expanded from here
   __do_outsb
   ^
   arch/powerpc/include/asm/io.h:559:58: note: expanded from macro '__do_outsb'
   #define __do_outsb(p, b, n)     writesb((PCI_IO_ADDR)_IO_BASE+(p),(b),(n))
                                           ~~~~~~~~~~~~~~~~~~~~~^
   In file included from drivers/net/dsa/qca/ar9331.c:44:
   In file included from include/linux/of_irq.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/powerpc/include/asm/io.h:619:
   arch/powerpc/include/asm/io-defs.h:51:1: warning: performing pointer 
arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
   DEF_PCI_AC_NORET(outsw, (unsigned long p, const void *b, unsigned long c),
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/powerpc/include/asm/io.h:616:3: note: expanded from macro 
'DEF_PCI_AC_NORET'
                   __do_##name al;                                 \
                   ^~~~~~~~~~~~~~
   <scratch space>:105:1: note: expanded from here
   __do_outsw
   ^
   arch/powerpc/include/asm/io.h:560:58: note: expanded from macro '__do_outsw'
   #define __do_outsw(p, b, n)     writesw((PCI_IO_ADDR)_IO_BASE+(p),(b),(n))
                                           ~~~~~~~~~~~~~~~~~~~~~^
   In file included from drivers/net/dsa/qca/ar9331.c:44:
   In file included from include/linux/of_irq.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/powerpc/include/asm/io.h:619:
   arch/powerpc/include/asm/io-defs.h:53:1: warning: performing pointer 
arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
   DEF_PCI_AC_NORET(outsl, (unsigned long p, const void *b, unsigned long c),
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   arch/powerpc/include/asm/io.h:616:3: note: expanded from macro 
'DEF_PCI_AC_NORET'
                   __do_##name al;                                 \
                   ^~~~~~~~~~~~~~
   <scratch space>:107:1: note: expanded from here
   __do_outsl
   ^
   arch/powerpc/include/asm/io.h:561:58: note: expanded from macro '__do_outsl'
   #define __do_outsl(p, b, n)     writesl((PCI_IO_ADDR)_IO_BASE+(p),(b),(n))
                                           ~~~~~~~~~~~~~~~~~~~~~^
>> drivers/net/dsa/qca/ar9331.c:971:47: warning: variable 'f2' is uninitialized 
>> when used here [-Wuninitialized]
           ret = ar9331_sw_port_fdb_write(priv, f0, f1, f2);
                                                        ^~
   drivers/net/dsa/qca/ar9331.c:961:16: note: initialize the variable 'f2' to 
silence this warning
           u32 f0, f1, f2;
                         ^
                          = 0
   7 warnings generated.


vim +/f2 +971 drivers/net/dsa/qca/ar9331.c

   954  
   955  static int ar9331_sw_port_fdb_rmw(struct ar9331_sw_priv *priv,
   956                                    const unsigned char *mac,
   957                                    u8 port_mask_set,
   958                                    u8 port_mask_clr)
   959  {
   960          struct regmap *regmap = priv->regmap;
   961          u32 f0, f1, f2;
   962          u8 port_mask, port_mask_new, status, func;
   963          int ret;
   964  
   965          ret = ar9331_sw_fdb_wait(priv, &f0);
   966          if (ret)
   967                  return ret;
   968  
   969          ar9331_sw_port_fdb_prepare(mac, &f0, &f1, 
AR9331_SW_AT_FUNC_FIND_MAC);
   970  
 > 971          ret = ar9331_sw_port_fdb_write(priv, f0, f1, f2);
   972          if (ret)
   973                  return ret;
   974  
   975          ret = ar9331_sw_fdb_wait(priv, &f0);
   976          if (ret)
   977                  return ret;
   978  
   979          ret = regmap_read(regmap, AR9331_SW_REG_ADDR_TABLE_FUNCTION2, 
&f2);
   980          if (ret)
   981                  return ret;
   982  
   983          port_mask = FIELD_GET(AR9331_SW_AT_DES_PORT, f2);
   984          status = FIELD_GET(AR9331_SW_AT_STATUS, f2);
   985          if (status > 0 && status < AR9331_SW_AT_STATUS_STATIC) {
   986                  dev_err_ratelimited(priv->dev, "%s: found existing 
dynamic entry on %x\n",
   987                                      __func__, port_mask);
   988  
   989                  if (port_mask_set && port_mask_set != port_mask)
   990                          dev_err_ratelimited(priv->dev, "%s: found 
existing dynamic entry on %x, replacing it with static on %x\n",
   991                                              __func__, port_mask, 
port_mask_set);
   992                  port_mask = 0;
   993          } else if (!status && !port_mask_set) {
   994                  return 0;
   995          }
   996  
   997          port_mask_new = port_mask & ~port_mask_clr;
   998          port_mask_new |= port_mask_set;
   999  
  1000          if (port_mask_new == port_mask &&
  1001              status == AR9331_SW_AT_STATUS_STATIC) {
  1002                  dev_info(priv->dev, "%s: no need to overwrite existing 
valid entry on %x\n",
  1003                                      __func__, port_mask_new);
  1004                  return 0;
  1005          }
  1006  
  1007          if (port_mask_new) {
  1008                  func = AR9331_SW_AT_FUNC_LOAD_ENTRY;
  1009          } else {
  1010                  func = AR9331_SW_AT_FUNC_PURGE_ENTRY;
  1011                  port_mask_new = port_mask;
  1012          }
  1013  
  1014          f2 = FIELD_PREP(AR9331_SW_AT_DES_PORT, port_mask_new) |
  1015                  FIELD_PREP(AR9331_SW_AT_STATUS, 
AR9331_SW_AT_STATUS_STATIC);
  1016  
  1017          ar9331_sw_port_fdb_prepare(mac, &f0, &f1, func);
  1018  
  1019          ret = ar9331_sw_port_fdb_write(priv, f0, f1, f2);
  1020          if (ret)
  1021                  return ret;
  1022  
  1023          ret = ar9331_sw_fdb_wait(priv, &f0);
  1024          if (ret)
  1025                  return ret;
  1026  
  1027          if (f0 & AR9331_SW_AT_FULL_VIO) {
  1028                  /* cleanup error status */
  1029                  regmap_write(regmap, 
AR9331_SW_REG_ADDR_TABLE_FUNCTION0, 0);
  1030                  dev_err_ratelimited(priv->dev, "%s: can't add new 
entry, ATU is full\n", __func__);
  1031                  return -ENOMEM;
  1032          }
  1033  
  1034          return 0;
  1035  }
  1036  

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

Attachment: .config.gz
Description: application/gzip

Reply via email to