Hi Szuying, Thank you for the patch! Yet something to improve: [auto build test ERROR on linus/master] [also build test ERROR on v6.0-rc1 next-20220816] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Szuying-Chen/thunderbolt-thunderbolt-add-vendor-s-NVM-formats/20220816-193757 base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 568035b01cfb107af8d2e4bd2fb9aea22cf5b868 config: s390-buildonly-randconfig-r004-20220815 (https://download.01.org/0day-ci/archive/20220817/202208170830.DW4YZvZF-lkp@xxxxxxxxx/config) compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project aed5e3bea138ce581d682158eb61c27b3cfdd6ec) 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/intel-lab-lkp/linux/commit/16b15f1135451c01b616a6a2bacf2f54a1082a08 git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Szuying-Chen/thunderbolt-thunderbolt-add-vendor-s-NVM-formats/20220816-193757 git checkout 16b15f1135451c01b616a6a2bacf2f54a1082a08 # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=s390 SHELL=/bin/bash drivers/thunderbolt/ If you fix the issue, kindly add following tag where applicable Reported-by: kernel test robot <lkp@xxxxxxxxx> All errors (new ones prefixed by >>): In file included from drivers/thunderbolt/nvm.c:14: In file included from drivers/thunderbolt/tb.h:13: In file included from include/linux/pci.h:39: In file included from include/linux/io.h:13: In file included from arch/s390/include/asm/io.h:75: include/asm-generic/io.h:547: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:560: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:37: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/thunderbolt/nvm.c:14: In file included from drivers/thunderbolt/tb.h:13: In file included from include/linux/pci.h:39: In file included from include/linux/io.h:13: In file included from arch/s390/include/asm/io.h:75: include/asm-generic/io.h:573: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:35: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/thunderbolt/nvm.c:14: In file included from drivers/thunderbolt/tb.h:13: In file included from include/linux/pci.h:39: In file included from include/linux/io.h:13: In file included from arch/s390/include/asm/io.h:75: include/asm-generic/io.h:584: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:594: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:604: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:692: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:700: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:708: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:717: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:726: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:735:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] writesl(PCI_IOBASE + addr, buffer, count); ~~~~~~~~~~ ^ drivers/thunderbolt/nvm.c:107:3: error: expected expression const u8 *buf = sw->nvm->buf; ^ >> drivers/thunderbolt/nvm.c:109:8: error: use of undeclared identifier 'buf' if (!buf) { ^ drivers/thunderbolt/nvm.c:118:38: error: use of undeclared identifier 'buf' ret = usb4_switch_nvm_write(sw, 0, buf, image_size); ^ 12 warnings and 3 errors generated. vim +/buf +109 drivers/thunderbolt/nvm.c 61 62 static int asmedia_nvm_validate(struct tb_switch *sw, unsigned int mode) 63 { 64 struct tb_nvm *nvm; 65 u32 val; 66 u32 nvm_size; 67 int ret = 0; 68 unsigned int image_size; 69 70 switch (mode) { 71 case NVM_UPGRADE: 72 if (sw->no_nvm_upgrade) 73 sw->no_nvm_upgrade = false; 74 75 break; 76 77 case NVM_ADD: 78 nvm = tb_nvm_alloc(&sw->dev); 79 if (IS_ERR(nvm)) { 80 ret = PTR_ERR(nvm); 81 break; 82 } 83 84 ret = usb4_switch_nvm_read(sw, ASMEDIA_NVM_VERSION, &val, sizeof(val)); 85 if (ret) 86 break; 87 88 nvm->nvm_asm.major = (((u8)val) << 0x10 | ((u8)(val >> 0x8)) << 0x8 | (u8)(val >> 0x10)); 89 ret = usb4_switch_nvm_read(sw, ASMEDIA_NVM_DATE, &val, sizeof(val)); 90 if (ret) 91 break; 92 93 nvm->nvm_asm.minor = (((u8)val) << 0x10 | ((u8)(val >> 0x8)) << 0x8 | (u8)(val >> 0x10)); 94 nvm_size = SZ_512K; 95 ret = tb_nvm_add_active(nvm, nvm_size, tb_switch_nvm_read); 96 if (ret) 97 break; 98 99 ret = tb_nvm_add_non_active(nvm, NVM_MAX_SIZE, tb_switch_nvm_write); 100 if (ret) 101 break; 102 103 sw->nvm = nvm; 104 break; 105 106 case NVM_WRITE: 107 const u8 *buf = sw->nvm->buf; 108 > 109 if (!buf) { 110 ret = -EINVAL; 111 break; 112 } 113 image_size = sw->nvm->buf_data_size; 114 if (image_size < NVM_MIN_SIZE || image_size > NVM_MAX_SIZE) { 115 ret = -EINVAL; 116 break; 117 } 118 ret = usb4_switch_nvm_write(sw, 0, buf, image_size); 119 if (!ret) 120 sw->nvm->flushed = true; 121 122 break; 123 124 default: 125 break; 126 } 127 128 if ((mode == NVM_ADD) && (ret != 0)) 129 tb_nvm_free(sw->nvm); 130 131 return ret; 132 } 133 -- 0-DAY CI Kernel Test Service https://01.org/lkp