tree: https://gitee.com/openeuler/kernel.git OLK-5.10 head: 4134526a9cfd552230ec7a66a1738a9066d9a0c6 commit: a5b9149cc6ef0e581c7289b01bf2bf3c2ad98248 [6341/30000] Huawei BMA: Adding Huawei BMA driver: host_kbox_drv config: x86_64-randconfig-122-20240413 (https://download.01.org/0day-ci/archive/20240414/202404140648.3413VbmQ-lkp@i...) compiler: clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240414/202404140648.3413VbmQ-lkp@i...)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot lkp@intel.com | Closes: https://lore.kernel.org/oe-kbuild-all/202404140648.3413VbmQ-lkp@intel.com/
sparse warnings: (new ones prefixed by >>)
drivers/net/ethernet/huawei/bma/kbox_drv/kbox_ram_op.c:51:28: sparse: sparse: cast removes address space '__iomem' of expression
drivers/net/ethernet/huawei/bma/kbox_drv/kbox_ram_op.c:42:6: sparse: sparse: symbol 'kbox_write_to_pci' was not declared. Should it be static? drivers/net/ethernet/huawei/bma/kbox_drv/kbox_ram_op.c:120:27: sparse: sparse: cast removes address space '__iomem' of expression drivers/net/ethernet/huawei/bma/kbox_drv/kbox_ram_op.c:111:6: sparse: sparse: symbol 'kbox_read_from_pci' was not declared. Should it be static? drivers/net/ethernet/huawei/bma/kbox_drv/kbox_ram_op.c:179:28: sparse: sparse: cast removes address space '__iomem' of expression drivers/net/ethernet/huawei/bma/kbox_drv/kbox_ram_op.c:172:6: sparse: sparse: symbol 'kbox_memset_pci' was not declared. Should it be static?
drivers/net/ethernet/huawei/bma/kbox_drv/kbox_ram_op.c:360:26: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected char *user_buf @@ got char [noderef] __user *data @@
drivers/net/ethernet/huawei/bma/kbox_drv/kbox_ram_op.c:360:26: sparse: expected char *user_buf drivers/net/ethernet/huawei/bma/kbox_drv/kbox_ram_op.c:360:26: sparse: got char [noderef] __user *data
drivers/net/ethernet/huawei/bma/kbox_drv/kbox_ram_op.c:395:34: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void [noderef] __user *to @@ got char *user_buf @@
drivers/net/ethernet/huawei/bma/kbox_drv/kbox_ram_op.c:395:34: sparse: expected void [noderef] __user *to drivers/net/ethernet/huawei/bma/kbox_drv/kbox_ram_op.c:395:34: sparse: got char *user_buf
drivers/net/ethernet/huawei/bma/kbox_drv/kbox_ram_op.c:422:32: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected char const *user_buf @@ got char const [noderef] __user *data @@
drivers/net/ethernet/huawei/bma/kbox_drv/kbox_ram_op.c:422:32: sparse: expected char const *user_buf drivers/net/ethernet/huawei/bma/kbox_drv/kbox_ram_op.c:422:32: sparse: got char const [noderef] __user *data
drivers/net/ethernet/huawei/bma/kbox_drv/kbox_ram_op.c:453:51: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void const [noderef] __user *from @@ got char const *user_buf @@
drivers/net/ethernet/huawei/bma/kbox_drv/kbox_ram_op.c:453:51: sparse: expected void const [noderef] __user *from drivers/net/ethernet/huawei/bma/kbox_drv/kbox_ram_op.c:453:51: sparse: got char const *user_buf
vim +/__iomem +51 drivers/net/ethernet/huawei/bma/kbox_drv/kbox_ram_op.c
41 42 void kbox_write_to_pci(void __iomem *dest, const void *src, int len, 43 unsigned long offset) 44 { 45 union char_int_transfer_u transfer = { }; 46 int idx = 0; 47 int j = 0; 48 int four_byte_len = 0; 49 int left_len = 0; 50 char *src_temp = (char *)src;
51 char *dest_temp = (char *)dest;
52 int first_write_num = 0; 53 54 if ((offset % KBOX_RW_UNIT) != 0) { 55 transfer.data_int = 56 *(int *)(dest_temp + offset - (offset % KBOX_RW_UNIT)); 57 58 rmb();/* memory barriers. */ 59 first_write_num = 60 ((len + (offset % KBOX_RW_UNIT)) > 61 KBOX_RW_UNIT) ? (KBOX_RW_UNIT - 62 (offset % KBOX_RW_UNIT)) : len; 63 for (idx = (int)(offset % KBOX_RW_UNIT); 64 idx < (int)(first_write_num + (offset % KBOX_RW_UNIT)); 65 idx++) { 66 if (!src_temp) 67 return; 68 69 transfer.data_char[idx] = *src_temp; 70 src_temp++; 71 } 72 *(int *)(dest_temp + offset - (offset % KBOX_RW_UNIT)) = 73 transfer.data_int; 74 wmb();/* memory barriers. */ 75 len -= first_write_num; 76 offset += first_write_num; 77 } 78 79 four_byte_len = (len / KBOX_RW_UNIT); 80 left_len = (len % KBOX_RW_UNIT); 81 for (idx = 0; idx < four_byte_len; idx++) { 82 for (j = 0; j < KBOX_RW_UNIT; j++) { 83 if (!src_temp) 84 return; 85 86 transfer.data_char[j] = *src_temp; 87 src_temp++; 88 } 89 *(int *)(dest_temp + offset) = transfer.data_int; 90 wmb();/* memory barriers. */ 91 offset += KBOX_RW_UNIT; 92 } 93 94 if (left_len != 0) { 95 transfer.data_int = *(int *)(dest_temp + offset); 96 rmb();/* memory barriers. */ 97 for (idx = 0; idx < left_len; idx++) { 98 if (!src_temp) 99 return; 100 101 transfer.data_char[idx] = *src_temp; 102 src_temp++; 103 } 104 *(int *)(dest_temp + offset) = transfer.data_int; 105 wmb();/* memory barriers. */ 106 } 107 108 udelay(1); 109 } 110