drivers/pci/endpoint/functions/pci-epf-test.c:288:24: sparse: sparse: incorrect type in argument 1 (different address spaces)

From: kernel test robot
Date: Mon Jun 29 2020 - 15:16:45 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 9ebcfadb0610322ac537dd7aa5d9cbc2b2894c68
commit: 670d0a4b10704667765f7d18f7592993d02783aa sparse: use identifiers to define address spaces
date: 11 days ago
config: parisc-randconfig-s032-20200629 (attached as .config)
compiler: hppa-linux-gcc (GCC) 9.3.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.2-3-gfa153962-dirty
git checkout 670d0a4b10704667765f7d18f7592993d02783aa
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C= CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=parisc

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


sparse warnings: (new ones prefixed by >>)

>> drivers/pci/endpoint/functions/pci-epf-test.c:288:24: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *dest @@ got void [noderef] __iomem *[assigned] dst_addr @@
drivers/pci/endpoint/functions/pci-epf-test.c:288:24: sparse: expected void *dest
drivers/pci/endpoint/functions/pci-epf-test.c:288:24: sparse: got void [noderef] __iomem *[assigned] dst_addr
>> drivers/pci/endpoint/functions/pci-epf-test.c:288:34: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void const *src @@ got void [noderef] __iomem *[assigned] src_addr @@
drivers/pci/endpoint/functions/pci-epf-test.c:288:34: sparse: expected void const *src
drivers/pci/endpoint/functions/pci-epf-test.c:288:34: sparse: got void [noderef] __iomem *[assigned] src_addr

vim +288 drivers/pci/endpoint/functions/pci-epf-test.c

5893c2e5353bb9 Kishon Vijay Abraham I 2020-03-16 226
349e7a85b25fa6 Kishon Vijay Abraham I 2017-03-27 227 static int pci_epf_test_copy(struct pci_epf_test *epf_test)
349e7a85b25fa6 Kishon Vijay Abraham I 2017-03-27 228 {
349e7a85b25fa6 Kishon Vijay Abraham I 2017-03-27 229 int ret;
5ebf3fc59bd20d Kishon Vijay Abraham I 2020-03-16 230 bool use_dma;
349e7a85b25fa6 Kishon Vijay Abraham I 2017-03-27 231 void __iomem *src_addr;
349e7a85b25fa6 Kishon Vijay Abraham I 2017-03-27 232 void __iomem *dst_addr;
349e7a85b25fa6 Kishon Vijay Abraham I 2017-03-27 233 phys_addr_t src_phys_addr;
349e7a85b25fa6 Kishon Vijay Abraham I 2017-03-27 234 phys_addr_t dst_phys_addr;
5893c2e5353bb9 Kishon Vijay Abraham I 2020-03-16 235 struct timespec64 start, end;
349e7a85b25fa6 Kishon Vijay Abraham I 2017-03-27 236 struct pci_epf *epf = epf_test->epf;
349e7a85b25fa6 Kishon Vijay Abraham I 2017-03-27 237 struct device *dev = &epf->dev;
349e7a85b25fa6 Kishon Vijay Abraham I 2017-03-27 238 struct pci_epc *epc = epf->epc;
3235b994950d84 Kishon Vijay Abraham I 2017-08-18 239 enum pci_barno test_reg_bar = epf_test->test_reg_bar;
3235b994950d84 Kishon Vijay Abraham I 2017-08-18 240 struct pci_epf_test_reg *reg = epf_test->reg[test_reg_bar];
349e7a85b25fa6 Kishon Vijay Abraham I 2017-03-27 241
349e7a85b25fa6 Kishon Vijay Abraham I 2017-03-27 242 src_addr = pci_epc_mem_alloc_addr(epc, &src_phys_addr, reg->size);
349e7a85b25fa6 Kishon Vijay Abraham I 2017-03-27 243 if (!src_addr) {
798c0441bec8c4 Gustavo Pimentel 2018-05-14 244 dev_err(dev, "Failed to allocate source address\n");
349e7a85b25fa6 Kishon Vijay Abraham I 2017-03-27 245 reg->status = STATUS_SRC_ADDR_INVALID;
349e7a85b25fa6 Kishon Vijay Abraham I 2017-03-27 246 ret = -ENOMEM;
349e7a85b25fa6 Kishon Vijay Abraham I 2017-03-27 247 goto err;
349e7a85b25fa6 Kishon Vijay Abraham I 2017-03-27 248 }
349e7a85b25fa6 Kishon Vijay Abraham I 2017-03-27 249
4494738de0d9dc Cyrille Pitchen 2018-01-30 250 ret = pci_epc_map_addr(epc, epf->func_no, src_phys_addr, reg->src_addr,
4494738de0d9dc Cyrille Pitchen 2018-01-30 251 reg->size);
349e7a85b25fa6 Kishon Vijay Abraham I 2017-03-27 252 if (ret) {
798c0441bec8c4 Gustavo Pimentel 2018-05-14 253 dev_err(dev, "Failed to map source address\n");
349e7a85b25fa6 Kishon Vijay Abraham I 2017-03-27 254 reg->status = STATUS_SRC_ADDR_INVALID;
349e7a85b25fa6 Kishon Vijay Abraham I 2017-03-27 255 goto err_src_addr;
349e7a85b25fa6 Kishon Vijay Abraham I 2017-03-27 256 }
349e7a85b25fa6 Kishon Vijay Abraham I 2017-03-27 257
349e7a85b25fa6 Kishon Vijay Abraham I 2017-03-27 258 dst_addr = pci_epc_mem_alloc_addr(epc, &dst_phys_addr, reg->size);
349e7a85b25fa6 Kishon Vijay Abraham I 2017-03-27 259 if (!dst_addr) {
798c0441bec8c4 Gustavo Pimentel 2018-05-14 260 dev_err(dev, "Failed to allocate destination address\n");
349e7a85b25fa6 Kishon Vijay Abraham I 2017-03-27 261 reg->status = STATUS_DST_ADDR_INVALID;
349e7a85b25fa6 Kishon Vijay Abraham I 2017-03-27 262 ret = -ENOMEM;
349e7a85b25fa6 Kishon Vijay Abraham I 2017-03-27 263 goto err_src_map_addr;
349e7a85b25fa6 Kishon Vijay Abraham I 2017-03-27 264 }
349e7a85b25fa6 Kishon Vijay Abraham I 2017-03-27 265
4494738de0d9dc Cyrille Pitchen 2018-01-30 266 ret = pci_epc_map_addr(epc, epf->func_no, dst_phys_addr, reg->dst_addr,
4494738de0d9dc Cyrille Pitchen 2018-01-30 267 reg->size);
349e7a85b25fa6 Kishon Vijay Abraham I 2017-03-27 268 if (ret) {
798c0441bec8c4 Gustavo Pimentel 2018-05-14 269 dev_err(dev, "Failed to map destination address\n");
349e7a85b25fa6 Kishon Vijay Abraham I 2017-03-27 270 reg->status = STATUS_DST_ADDR_INVALID;
349e7a85b25fa6 Kishon Vijay Abraham I 2017-03-27 271 goto err_dst_addr;
349e7a85b25fa6 Kishon Vijay Abraham I 2017-03-27 272 }
349e7a85b25fa6 Kishon Vijay Abraham I 2017-03-27 273
5893c2e5353bb9 Kishon Vijay Abraham I 2020-03-16 274 ktime_get_ts64(&start);
5ebf3fc59bd20d Kishon Vijay Abraham I 2020-03-16 275 use_dma = !!(reg->flags & FLAG_USE_DMA);
5ebf3fc59bd20d Kishon Vijay Abraham I 2020-03-16 276 if (use_dma) {
5ebf3fc59bd20d Kishon Vijay Abraham I 2020-03-16 277 if (!epf_test->dma_supported) {
5ebf3fc59bd20d Kishon Vijay Abraham I 2020-03-16 278 dev_err(dev, "Cannot transfer data using DMA\n");
5ebf3fc59bd20d Kishon Vijay Abraham I 2020-03-16 279 ret = -EINVAL;
5ebf3fc59bd20d Kishon Vijay Abraham I 2020-03-16 280 goto err_map_addr;
5ebf3fc59bd20d Kishon Vijay Abraham I 2020-03-16 281 }
5ebf3fc59bd20d Kishon Vijay Abraham I 2020-03-16 282
5ebf3fc59bd20d Kishon Vijay Abraham I 2020-03-16 283 ret = pci_epf_test_data_transfer(epf_test, dst_phys_addr,
5ebf3fc59bd20d Kishon Vijay Abraham I 2020-03-16 284 src_phys_addr, reg->size);
5ebf3fc59bd20d Kishon Vijay Abraham I 2020-03-16 285 if (ret)
5ebf3fc59bd20d Kishon Vijay Abraham I 2020-03-16 286 dev_err(dev, "Data transfer failed\n");
5ebf3fc59bd20d Kishon Vijay Abraham I 2020-03-16 287 } else {
349e7a85b25fa6 Kishon Vijay Abraham I 2017-03-27 @288 memcpy(dst_addr, src_addr, reg->size);
5ebf3fc59bd20d Kishon Vijay Abraham I 2020-03-16 289 }
5893c2e5353bb9 Kishon Vijay Abraham I 2020-03-16 290 ktime_get_ts64(&end);
5893c2e5353bb9 Kishon Vijay Abraham I 2020-03-16 291 pci_epf_test_print_rate("COPY", reg->size, &start, &end, use_dma);
349e7a85b25fa6 Kishon Vijay Abraham I 2017-03-27 292
5ebf3fc59bd20d Kishon Vijay Abraham I 2020-03-16 293 err_map_addr:
4494738de0d9dc Cyrille Pitchen 2018-01-30 294 pci_epc_unmap_addr(epc, epf->func_no, dst_phys_addr);
349e7a85b25fa6 Kishon Vijay Abraham I 2017-03-27 295
349e7a85b25fa6 Kishon Vijay Abraham I 2017-03-27 296 err_dst_addr:
349e7a85b25fa6 Kishon Vijay Abraham I 2017-03-27 297 pci_epc_mem_free_addr(epc, dst_phys_addr, dst_addr, reg->size);
349e7a85b25fa6 Kishon Vijay Abraham I 2017-03-27 298
349e7a85b25fa6 Kishon Vijay Abraham I 2017-03-27 299 err_src_map_addr:
4494738de0d9dc Cyrille Pitchen 2018-01-30 300 pci_epc_unmap_addr(epc, epf->func_no, src_phys_addr);
349e7a85b25fa6 Kishon Vijay Abraham I 2017-03-27 301
349e7a85b25fa6 Kishon Vijay Abraham I 2017-03-27 302 err_src_addr:
349e7a85b25fa6 Kishon Vijay Abraham I 2017-03-27 303 pci_epc_mem_free_addr(epc, src_phys_addr, src_addr, reg->size);
349e7a85b25fa6 Kishon Vijay Abraham I 2017-03-27 304
349e7a85b25fa6 Kishon Vijay Abraham I 2017-03-27 305 err:
349e7a85b25fa6 Kishon Vijay Abraham I 2017-03-27 306 return ret;
349e7a85b25fa6 Kishon Vijay Abraham I 2017-03-27 307 }
349e7a85b25fa6 Kishon Vijay Abraham I 2017-03-27 308

:::::: The code at line 288 was first introduced by commit
:::::: 349e7a85b25fa6ee82902d9be2cc5f3bec815120 PCI: endpoint: functions: Add an EP function to test PCI

:::::: TO: Kishon Vijay Abraham I <kishon@xxxxxx>
:::::: CC: Bjorn Helgaas <bhelgaas@xxxxxxxxxx>

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

Attachment: .config.gz
Description: application/gzip