drivers/pci/controller/dwc/pcie-spear13xx.c:76:54: sparse: sparse: incorrect type in initializer (different address spaces)

From: kernel test robot
Date: Sun Jul 12 2020 - 15:24:50 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 0aea6d5c5be33ce94c16f9ab2f64de1f481f424b
commit: 670d0a4b10704667765f7d18f7592993d02783aa sparse: use identifiers to define address spaces
date: 3 weeks ago
config: x86_64-randconfig-s021-20200713 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-14) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.2-37-gc9676a3b-dirty
git checkout 670d0a4b10704667765f7d18f7592993d02783aa
# save the attached .config to linux build tree
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=x86_64

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/controller/dwc/pcie-spear13xx.c:76:54: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected struct pcie_app_reg *app_reg @@ got void [noderef] __iomem *app_base @@
drivers/pci/controller/dwc/pcie-spear13xx.c:76:54: sparse: expected struct pcie_app_reg *app_reg
>> drivers/pci/controller/dwc/pcie-spear13xx.c:76:54: sparse: got void [noderef] __iomem *app_base
>> drivers/pci/controller/dwc/pcie-spear13xx.c:127:26: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void volatile [noderef] __iomem *addr @@ got unsigned int * @@
>> drivers/pci/controller/dwc/pcie-spear13xx.c:127:26: sparse: expected void volatile [noderef] __iomem *addr
drivers/pci/controller/dwc/pcie-spear13xx.c:127:26: sparse: got unsigned int *
drivers/pci/controller/dwc/pcie-spear13xx.c:135:54: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected struct pcie_app_reg *app_reg @@ got void [noderef] __iomem *app_base @@
drivers/pci/controller/dwc/pcie-spear13xx.c:135:54: sparse: expected struct pcie_app_reg *app_reg
drivers/pci/controller/dwc/pcie-spear13xx.c:135:54: sparse: got void [noderef] __iomem *app_base
>> drivers/pci/controller/dwc/pcie-spear13xx.c:140:25: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __iomem *addr @@ got unsigned int * @@
>> drivers/pci/controller/dwc/pcie-spear13xx.c:140:25: sparse: expected void const volatile [noderef] __iomem *addr
drivers/pci/controller/dwc/pcie-spear13xx.c:140:25: sparse: got unsigned int *
drivers/pci/controller/dwc/pcie-spear13xx.c:147:25: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void volatile [noderef] __iomem *addr @@ got unsigned int * @@
drivers/pci/controller/dwc/pcie-spear13xx.c:147:25: sparse: expected void volatile [noderef] __iomem *addr
drivers/pci/controller/dwc/pcie-spear13xx.c:147:25: sparse: got unsigned int *
drivers/pci/controller/dwc/pcie-spear13xx.c:156:54: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected struct pcie_app_reg *app_reg @@ got void [noderef] __iomem *app_base @@
drivers/pci/controller/dwc/pcie-spear13xx.c:156:54: sparse: expected struct pcie_app_reg *app_reg
drivers/pci/controller/dwc/pcie-spear13xx.c:156:54: sparse: got void [noderef] __iomem *app_base
drivers/pci/controller/dwc/pcie-spear13xx.c:161:31: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __iomem *addr @@ got unsigned int * @@
drivers/pci/controller/dwc/pcie-spear13xx.c:161:31: sparse: expected void const volatile [noderef] __iomem *addr
drivers/pci/controller/dwc/pcie-spear13xx.c:161:31: sparse: got unsigned int *
drivers/pci/controller/dwc/pcie-spear13xx.c:162:48: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void volatile [noderef] __iomem *addr @@ got unsigned int * @@
drivers/pci/controller/dwc/pcie-spear13xx.c:162:48: sparse: expected void volatile [noderef] __iomem *addr
drivers/pci/controller/dwc/pcie-spear13xx.c:162:48: sparse: got unsigned int *
drivers/pci/controller/dwc/pcie-spear13xx.c:169:54: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected struct pcie_app_reg *app_reg @@ got void [noderef] __iomem *app_base @@
drivers/pci/controller/dwc/pcie-spear13xx.c:169:54: sparse: expected struct pcie_app_reg *app_reg
drivers/pci/controller/dwc/pcie-spear13xx.c:169:54: sparse: got void [noderef] __iomem *app_base
drivers/pci/controller/dwc/pcie-spear13xx.c:171:20: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __iomem *addr @@ got unsigned int * @@
drivers/pci/controller/dwc/pcie-spear13xx.c:171:20: sparse: expected void const volatile [noderef] __iomem *addr
drivers/pci/controller/dwc/pcie-spear13xx.c:171:20: sparse: got unsigned int *

vim +76 drivers/pci/controller/dwc/pcie-spear13xx.c

51b66a6ce12570 drivers/pci/host/pcie-spear13xx.c Pratyush Anand 2014-02-11 71
ffe82fa66afb19 drivers/pci/host/pcie-spear13xx.c Bjorn Helgaas 2016-10-06 72 static int spear13xx_pcie_establish_link(struct spear13xx_pcie *spear13xx_pcie)
51b66a6ce12570 drivers/pci/host/pcie-spear13xx.c Pratyush Anand 2014-02-11 73 {
442ec4c04d1235 drivers/pci/dwc/pcie-spear13xx.c Kishon Vijay Abraham I 2017-02-15 74 struct dw_pcie *pci = spear13xx_pcie->pci;
442ec4c04d1235 drivers/pci/dwc/pcie-spear13xx.c Kishon Vijay Abraham I 2017-02-15 75 struct pcie_port *pp = &pci->pp;
51b66a6ce12570 drivers/pci/host/pcie-spear13xx.c Pratyush Anand 2014-02-11 @76 struct pcie_app_reg *app_reg = spear13xx_pcie->app_base;
ffe82fa66afb19 drivers/pci/host/pcie-spear13xx.c Bjorn Helgaas 2016-10-06 77 u32 val;
51b66a6ce12570 drivers/pci/host/pcie-spear13xx.c Pratyush Anand 2014-02-11 78 u32 exp_cap_off = EXP_CAP_ID_OFFSET;
51b66a6ce12570 drivers/pci/host/pcie-spear13xx.c Pratyush Anand 2014-02-11 79
442ec4c04d1235 drivers/pci/dwc/pcie-spear13xx.c Kishon Vijay Abraham I 2017-02-15 80 if (dw_pcie_link_up(pci)) {
442ec4c04d1235 drivers/pci/dwc/pcie-spear13xx.c Kishon Vijay Abraham I 2017-02-15 81 dev_err(pci->dev, "link already up\n");
51b66a6ce12570 drivers/pci/host/pcie-spear13xx.c Pratyush Anand 2014-02-11 82 return 0;
51b66a6ce12570 drivers/pci/host/pcie-spear13xx.c Pratyush Anand 2014-02-11 83 }
51b66a6ce12570 drivers/pci/host/pcie-spear13xx.c Pratyush Anand 2014-02-11 84
51b66a6ce12570 drivers/pci/host/pcie-spear13xx.c Pratyush Anand 2014-02-11 85 dw_pcie_setup_rc(pp);
51b66a6ce12570 drivers/pci/host/pcie-spear13xx.c Pratyush Anand 2014-02-11 86
51b66a6ce12570 drivers/pci/host/pcie-spear13xx.c Pratyush Anand 2014-02-11 87 /*
51b66a6ce12570 drivers/pci/host/pcie-spear13xx.c Pratyush Anand 2014-02-11 88 * this controller support only 128 bytes read size, however its
51b66a6ce12570 drivers/pci/host/pcie-spear13xx.c Pratyush Anand 2014-02-11 89 * default value in capability register is 512 bytes. So force
51b66a6ce12570 drivers/pci/host/pcie-spear13xx.c Pratyush Anand 2014-02-11 90 * it to 128 here.
51b66a6ce12570 drivers/pci/host/pcie-spear13xx.c Pratyush Anand 2014-02-11 91 */
442ec4c04d1235 drivers/pci/dwc/pcie-spear13xx.c Kishon Vijay Abraham I 2017-02-15 92 dw_pcie_read(pci->dbi_base + exp_cap_off + PCI_EXP_DEVCTL, 2, &val);
51b66a6ce12570 drivers/pci/host/pcie-spear13xx.c Pratyush Anand 2014-02-11 93 val &= ~PCI_EXP_DEVCTL_READRQ;
442ec4c04d1235 drivers/pci/dwc/pcie-spear13xx.c Kishon Vijay Abraham I 2017-02-15 94 dw_pcie_write(pci->dbi_base + exp_cap_off + PCI_EXP_DEVCTL, 2, val);
51b66a6ce12570 drivers/pci/host/pcie-spear13xx.c Pratyush Anand 2014-02-11 95
442ec4c04d1235 drivers/pci/dwc/pcie-spear13xx.c Kishon Vijay Abraham I 2017-02-15 96 dw_pcie_write(pci->dbi_base + PCI_VENDOR_ID, 2, 0x104A);
442ec4c04d1235 drivers/pci/dwc/pcie-spear13xx.c Kishon Vijay Abraham I 2017-02-15 97 dw_pcie_write(pci->dbi_base + PCI_DEVICE_ID, 2, 0xCD80);
51b66a6ce12570 drivers/pci/host/pcie-spear13xx.c Pratyush Anand 2014-02-11 98
51b66a6ce12570 drivers/pci/host/pcie-spear13xx.c Pratyush Anand 2014-02-11 99 /*
51b66a6ce12570 drivers/pci/host/pcie-spear13xx.c Pratyush Anand 2014-02-11 100 * if is_gen1 is set then handle it, so that some buggy card
51b66a6ce12570 drivers/pci/host/pcie-spear13xx.c Pratyush Anand 2014-02-11 101 * also works
51b66a6ce12570 drivers/pci/host/pcie-spear13xx.c Pratyush Anand 2014-02-11 102 */
51b66a6ce12570 drivers/pci/host/pcie-spear13xx.c Pratyush Anand 2014-02-11 103 if (spear13xx_pcie->is_gen1) {
442ec4c04d1235 drivers/pci/dwc/pcie-spear13xx.c Kishon Vijay Abraham I 2017-02-15 104 dw_pcie_read(pci->dbi_base + exp_cap_off + PCI_EXP_LNKCAP,
4c45852f494dab drivers/pci/host/pcie-spear13xx.c Gabriele Paoloni 2015-10-08 105 4, &val);
51b66a6ce12570 drivers/pci/host/pcie-spear13xx.c Pratyush Anand 2014-02-11 106 if ((val & PCI_EXP_LNKCAP_SLS) != PCI_EXP_LNKCAP_SLS_2_5GB) {
51b66a6ce12570 drivers/pci/host/pcie-spear13xx.c Pratyush Anand 2014-02-11 107 val &= ~((u32)PCI_EXP_LNKCAP_SLS);
51b66a6ce12570 drivers/pci/host/pcie-spear13xx.c Pratyush Anand 2014-02-11 108 val |= PCI_EXP_LNKCAP_SLS_2_5GB;
442ec4c04d1235 drivers/pci/dwc/pcie-spear13xx.c Kishon Vijay Abraham I 2017-02-15 109 dw_pcie_write(pci->dbi_base + exp_cap_off +
4c45852f494dab drivers/pci/host/pcie-spear13xx.c Gabriele Paoloni 2015-10-08 110 PCI_EXP_LNKCAP, 4, val);
51b66a6ce12570 drivers/pci/host/pcie-spear13xx.c Pratyush Anand 2014-02-11 111 }
51b66a6ce12570 drivers/pci/host/pcie-spear13xx.c Pratyush Anand 2014-02-11 112
442ec4c04d1235 drivers/pci/dwc/pcie-spear13xx.c Kishon Vijay Abraham I 2017-02-15 113 dw_pcie_read(pci->dbi_base + exp_cap_off + PCI_EXP_LNKCTL2,
4c45852f494dab drivers/pci/host/pcie-spear13xx.c Gabriele Paoloni 2015-10-08 114 2, &val);
51b66a6ce12570 drivers/pci/host/pcie-spear13xx.c Pratyush Anand 2014-02-11 115 if ((val & PCI_EXP_LNKCAP_SLS) != PCI_EXP_LNKCAP_SLS_2_5GB) {
51b66a6ce12570 drivers/pci/host/pcie-spear13xx.c Pratyush Anand 2014-02-11 116 val &= ~((u32)PCI_EXP_LNKCAP_SLS);
51b66a6ce12570 drivers/pci/host/pcie-spear13xx.c Pratyush Anand 2014-02-11 117 val |= PCI_EXP_LNKCAP_SLS_2_5GB;
442ec4c04d1235 drivers/pci/dwc/pcie-spear13xx.c Kishon Vijay Abraham I 2017-02-15 118 dw_pcie_write(pci->dbi_base + exp_cap_off +
4c45852f494dab drivers/pci/host/pcie-spear13xx.c Gabriele Paoloni 2015-10-08 119 PCI_EXP_LNKCTL2, 2, val);
51b66a6ce12570 drivers/pci/host/pcie-spear13xx.c Pratyush Anand 2014-02-11 120 }
51b66a6ce12570 drivers/pci/host/pcie-spear13xx.c Pratyush Anand 2014-02-11 121 }
51b66a6ce12570 drivers/pci/host/pcie-spear13xx.c Pratyush Anand 2014-02-11 122
51b66a6ce12570 drivers/pci/host/pcie-spear13xx.c Pratyush Anand 2014-02-11 123 /* enable ltssm */
51b66a6ce12570 drivers/pci/host/pcie-spear13xx.c Pratyush Anand 2014-02-11 124 writel(DEVICE_TYPE_RC | (1 << MISCTRL_EN_ID)
51b66a6ce12570 drivers/pci/host/pcie-spear13xx.c Pratyush Anand 2014-02-11 125 | (1 << APP_LTSSM_ENABLE_ID)
51b66a6ce12570 drivers/pci/host/pcie-spear13xx.c Pratyush Anand 2014-02-11 126 | ((u32)1 << REG_TRANSLATION_ENABLE),
51b66a6ce12570 drivers/pci/host/pcie-spear13xx.c Pratyush Anand 2014-02-11 @127 &app_reg->app_ctrl_0);
51b66a6ce12570 drivers/pci/host/pcie-spear13xx.c Pratyush Anand 2014-02-11 128
442ec4c04d1235 drivers/pci/dwc/pcie-spear13xx.c Kishon Vijay Abraham I 2017-02-15 129 return dw_pcie_wait_for_link(pci);
51b66a6ce12570 drivers/pci/host/pcie-spear13xx.c Pratyush Anand 2014-02-11 130 }
51b66a6ce12570 drivers/pci/host/pcie-spear13xx.c Pratyush Anand 2014-02-11 131
51b66a6ce12570 drivers/pci/host/pcie-spear13xx.c Pratyush Anand 2014-02-11 132 static irqreturn_t spear13xx_pcie_irq_handler(int irq, void *arg)
51b66a6ce12570 drivers/pci/host/pcie-spear13xx.c Pratyush Anand 2014-02-11 133 {
ffe82fa66afb19 drivers/pci/host/pcie-spear13xx.c Bjorn Helgaas 2016-10-06 134 struct spear13xx_pcie *spear13xx_pcie = arg;
51b66a6ce12570 drivers/pci/host/pcie-spear13xx.c Pratyush Anand 2014-02-11 135 struct pcie_app_reg *app_reg = spear13xx_pcie->app_base;
442ec4c04d1235 drivers/pci/dwc/pcie-spear13xx.c Kishon Vijay Abraham I 2017-02-15 136 struct dw_pcie *pci = spear13xx_pcie->pci;
442ec4c04d1235 drivers/pci/dwc/pcie-spear13xx.c Kishon Vijay Abraham I 2017-02-15 137 struct pcie_port *pp = &pci->pp;
51b66a6ce12570 drivers/pci/host/pcie-spear13xx.c Pratyush Anand 2014-02-11 138 unsigned int status;
51b66a6ce12570 drivers/pci/host/pcie-spear13xx.c Pratyush Anand 2014-02-11 139
51b66a6ce12570 drivers/pci/host/pcie-spear13xx.c Pratyush Anand 2014-02-11 @140 status = readl(&app_reg->int_sts);
51b66a6ce12570 drivers/pci/host/pcie-spear13xx.c Pratyush Anand 2014-02-11 141
51b66a6ce12570 drivers/pci/host/pcie-spear13xx.c Pratyush Anand 2014-02-11 142 if (status & MSI_CTRL_INT) {
68ebb7ce395c6d drivers/pci/host/pcie-spear13xx.c Fabio Estevam 2015-08-20 143 BUG_ON(!IS_ENABLED(CONFIG_PCI_MSI));
51b66a6ce12570 drivers/pci/host/pcie-spear13xx.c Pratyush Anand 2014-02-11 144 dw_handle_msi_irq(pp);
51b66a6ce12570 drivers/pci/host/pcie-spear13xx.c Pratyush Anand 2014-02-11 145 }
51b66a6ce12570 drivers/pci/host/pcie-spear13xx.c Pratyush Anand 2014-02-11 146
51b66a6ce12570 drivers/pci/host/pcie-spear13xx.c Pratyush Anand 2014-02-11 147 writel(status, &app_reg->int_clr);
51b66a6ce12570 drivers/pci/host/pcie-spear13xx.c Pratyush Anand 2014-02-11 148
51b66a6ce12570 drivers/pci/host/pcie-spear13xx.c Pratyush Anand 2014-02-11 149 return IRQ_HANDLED;
51b66a6ce12570 drivers/pci/host/pcie-spear13xx.c Pratyush Anand 2014-02-11 150 }
51b66a6ce12570 drivers/pci/host/pcie-spear13xx.c Pratyush Anand 2014-02-11 151

:::::: The code at line 76 was first introduced by commit
:::::: 51b66a6ce12570e5ee1a249c811f7f2d74814a43 PCI: spear: Add PCIe driver for ST Microelectronics SPEAr13xx

:::::: TO: Pratyush Anand <pratyush.anand@xxxxxx>
:::::: CC: Viresh Kumar <viresh.kumar@xxxxxxxxxx>

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

Attachment: .config.gz
Description: application/gzip