drivers/pci/controller/dwc/pcie-hisi.c:61:37: sparse: sparse: incorrect type in initializer (different address spaces)

From: kernel test robot
Date: Tue Nov 23 2021 - 18:23:03 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 136057256686de39cc3a07c2e39ef6bc43003ff6
commit: 6e5a1fff9096ecd259dedcbbdc812aa90986a40e PCI: Avoid building empty drivers
date: 9 months ago
config: alpha-randconfig-s032-20211117 (https://download.01.org/0day-ci/archive/20211124/202111240751.80Rfb1Es-lkp@xxxxxxxxx/config.gz)
compiler: alpha-linux-gcc (GCC) 11.2.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.4-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=6e5a1fff9096ecd259dedcbbdc812aa90986a40e
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 6e5a1fff9096ecd259dedcbbdc812aa90986a40e
# save the config file to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=alpha

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-hisi.c:61:37: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected void [noderef] __iomem *reg_base @@ got void *priv @@
drivers/pci/controller/dwc/pcie-hisi.c:61:37: sparse: expected void [noderef] __iomem *reg_base
drivers/pci/controller/dwc/pcie-hisi.c:61:37: sparse: got void *priv
>> drivers/pci/controller/dwc/pcie-hisi.c:132:19: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected void *priv @@ got void [noderef] __iomem *[assigned] reg_base @@
drivers/pci/controller/dwc/pcie-hisi.c:132:19: sparse: expected void *priv
drivers/pci/controller/dwc/pcie-hisi.c:132:19: sparse: got void [noderef] __iomem *[assigned] reg_base

vim +61 drivers/pci/controller/dwc/pcie-hisi.c

5f00f1a0178cf5 drivers/pci/host/pcie-hisi.c Dongdong Liu 2016-12-01 56
5f00f1a0178cf5 drivers/pci/host/pcie-hisi.c Dongdong Liu 2016-12-01 57 static void __iomem *hisi_pcie_map_bus(struct pci_bus *bus, unsigned int devfn,
5f00f1a0178cf5 drivers/pci/host/pcie-hisi.c Dongdong Liu 2016-12-01 58 int where)
5f00f1a0178cf5 drivers/pci/host/pcie-hisi.c Dongdong Liu 2016-12-01 59 {
5f00f1a0178cf5 drivers/pci/host/pcie-hisi.c Dongdong Liu 2016-12-01 60 struct pci_config_window *cfg = bus->sysdata;
5f00f1a0178cf5 drivers/pci/host/pcie-hisi.c Dongdong Liu 2016-12-01 @61 void __iomem *reg_base = cfg->priv;
5f00f1a0178cf5 drivers/pci/host/pcie-hisi.c Dongdong Liu 2016-12-01 62
5f00f1a0178cf5 drivers/pci/host/pcie-hisi.c Dongdong Liu 2016-12-01 63 if (bus->number == cfg->busr.start)
5f00f1a0178cf5 drivers/pci/host/pcie-hisi.c Dongdong Liu 2016-12-01 64 return reg_base + where;
5f00f1a0178cf5 drivers/pci/host/pcie-hisi.c Dongdong Liu 2016-12-01 65 else
5f00f1a0178cf5 drivers/pci/host/pcie-hisi.c Dongdong Liu 2016-12-01 66 return pci_ecam_map_bus(bus, devfn, where);
5f00f1a0178cf5 drivers/pci/host/pcie-hisi.c Dongdong Liu 2016-12-01 67 }
5f00f1a0178cf5 drivers/pci/host/pcie-hisi.c Dongdong Liu 2016-12-01 68
a2ec1996098c7d drivers/pci/host/pcie-hisi.c Dongdong Liu 2017-02-06 69 #if defined(CONFIG_ACPI) && defined(CONFIG_PCI_QUIRKS)
a2ec1996098c7d drivers/pci/host/pcie-hisi.c Dongdong Liu 2017-02-06 70
5f00f1a0178cf5 drivers/pci/host/pcie-hisi.c Dongdong Liu 2016-12-01 71 static int hisi_pcie_init(struct pci_config_window *cfg)
5f00f1a0178cf5 drivers/pci/host/pcie-hisi.c Dongdong Liu 2016-12-01 72 {
5f00f1a0178cf5 drivers/pci/host/pcie-hisi.c Dongdong Liu 2016-12-01 73 struct device *dev = cfg->parent;
5f00f1a0178cf5 drivers/pci/host/pcie-hisi.c Dongdong Liu 2016-12-01 74 struct acpi_device *adev = to_acpi_device(dev);
5f00f1a0178cf5 drivers/pci/host/pcie-hisi.c Dongdong Liu 2016-12-01 75 struct acpi_pci_root *root = acpi_driver_data(adev);
5f00f1a0178cf5 drivers/pci/host/pcie-hisi.c Dongdong Liu 2016-12-01 76 struct resource *res;
5f00f1a0178cf5 drivers/pci/host/pcie-hisi.c Dongdong Liu 2016-12-01 77 void __iomem *reg_base;
5f00f1a0178cf5 drivers/pci/host/pcie-hisi.c Dongdong Liu 2016-12-01 78 int ret;
5f00f1a0178cf5 drivers/pci/host/pcie-hisi.c Dongdong Liu 2016-12-01 79
5f00f1a0178cf5 drivers/pci/host/pcie-hisi.c Dongdong Liu 2016-12-01 80 /*
5f00f1a0178cf5 drivers/pci/host/pcie-hisi.c Dongdong Liu 2016-12-01 81 * Retrieve RC base and size from a HISI0081 device with _UID
5f00f1a0178cf5 drivers/pci/host/pcie-hisi.c Dongdong Liu 2016-12-01 82 * matching our segment.
5f00f1a0178cf5 drivers/pci/host/pcie-hisi.c Dongdong Liu 2016-12-01 83 */
5f00f1a0178cf5 drivers/pci/host/pcie-hisi.c Dongdong Liu 2016-12-01 84 res = devm_kzalloc(dev, sizeof(*res), GFP_KERNEL);
5f00f1a0178cf5 drivers/pci/host/pcie-hisi.c Dongdong Liu 2016-12-01 85 if (!res)
5f00f1a0178cf5 drivers/pci/host/pcie-hisi.c Dongdong Liu 2016-12-01 86 return -ENOMEM;
5f00f1a0178cf5 drivers/pci/host/pcie-hisi.c Dongdong Liu 2016-12-01 87
5f00f1a0178cf5 drivers/pci/host/pcie-hisi.c Dongdong Liu 2016-12-01 88 ret = acpi_get_rc_resources(dev, "HISI0081", root->segment, res);
5f00f1a0178cf5 drivers/pci/host/pcie-hisi.c Dongdong Liu 2016-12-01 89 if (ret) {
5f00f1a0178cf5 drivers/pci/host/pcie-hisi.c Dongdong Liu 2016-12-01 90 dev_err(dev, "can't get rc base address\n");
5f00f1a0178cf5 drivers/pci/host/pcie-hisi.c Dongdong Liu 2016-12-01 91 return -ENOMEM;
5f00f1a0178cf5 drivers/pci/host/pcie-hisi.c Dongdong Liu 2016-12-01 92 }
5f00f1a0178cf5 drivers/pci/host/pcie-hisi.c Dongdong Liu 2016-12-01 93
e313a447e73527 drivers/pci/dwc/pcie-hisi.c Lorenzo Pieralisi 2017-04-19 94 reg_base = devm_pci_remap_cfgspace(dev, res->start, resource_size(res));
5f00f1a0178cf5 drivers/pci/host/pcie-hisi.c Dongdong Liu 2016-12-01 95 if (!reg_base)
5f00f1a0178cf5 drivers/pci/host/pcie-hisi.c Dongdong Liu 2016-12-01 96 return -ENOMEM;
5f00f1a0178cf5 drivers/pci/host/pcie-hisi.c Dongdong Liu 2016-12-01 97
5f00f1a0178cf5 drivers/pci/host/pcie-hisi.c Dongdong Liu 2016-12-01 98 cfg->priv = reg_base;
5f00f1a0178cf5 drivers/pci/host/pcie-hisi.c Dongdong Liu 2016-12-01 99 return 0;
5f00f1a0178cf5 drivers/pci/host/pcie-hisi.c Dongdong Liu 2016-12-01 100 }
5f00f1a0178cf5 drivers/pci/host/pcie-hisi.c Dongdong Liu 2016-12-01 101
0b104773b4f72c drivers/pci/controller/dwc/pcie-hisi.c Rob Herring 2020-04-09 102 const struct pci_ecam_ops hisi_pcie_ops = {
5f00f1a0178cf5 drivers/pci/host/pcie-hisi.c Dongdong Liu 2016-12-01 103 .init = hisi_pcie_init,
5f00f1a0178cf5 drivers/pci/host/pcie-hisi.c Dongdong Liu 2016-12-01 104 .pci_ops = {
5f00f1a0178cf5 drivers/pci/host/pcie-hisi.c Dongdong Liu 2016-12-01 105 .map_bus = hisi_pcie_map_bus,
4788316f743539 drivers/pci/host/pcie-hisi.c Bjorn Helgaas 2017-02-07 106 .read = hisi_pcie_rd_conf,
4788316f743539 drivers/pci/host/pcie-hisi.c Bjorn Helgaas 2017-02-07 107 .write = hisi_pcie_wr_conf,
5f00f1a0178cf5 drivers/pci/host/pcie-hisi.c Dongdong Liu 2016-12-01 108 }
5f00f1a0178cf5 drivers/pci/host/pcie-hisi.c Dongdong Liu 2016-12-01 109 };
5f00f1a0178cf5 drivers/pci/host/pcie-hisi.c Dongdong Liu 2016-12-01 110
5f00f1a0178cf5 drivers/pci/host/pcie-hisi.c Dongdong Liu 2016-12-01 111 #endif
5f00f1a0178cf5 drivers/pci/host/pcie-hisi.c Dongdong Liu 2016-12-01 112
5f00f1a0178cf5 drivers/pci/host/pcie-hisi.c Dongdong Liu 2016-12-01 113 #ifdef CONFIG_PCI_HISI
500a1d9a43e0a1 drivers/pci/host/pcie-hisi.c Zhou Wang 2015-10-29 114
a2ec1996098c7d drivers/pci/host/pcie-hisi.c Dongdong Liu 2017-02-06 115 static int hisi_pcie_platform_init(struct pci_config_window *cfg)
a2ec1996098c7d drivers/pci/host/pcie-hisi.c Dongdong Liu 2017-02-06 116 {
a2ec1996098c7d drivers/pci/host/pcie-hisi.c Dongdong Liu 2017-02-06 117 struct device *dev = cfg->parent;
a2ec1996098c7d drivers/pci/host/pcie-hisi.c Dongdong Liu 2017-02-06 118 struct platform_device *pdev = to_platform_device(dev);
a2ec1996098c7d drivers/pci/host/pcie-hisi.c Dongdong Liu 2017-02-06 119 struct resource *res;
a2ec1996098c7d drivers/pci/host/pcie-hisi.c Dongdong Liu 2017-02-06 120 void __iomem *reg_base;
a2ec1996098c7d drivers/pci/host/pcie-hisi.c Dongdong Liu 2017-02-06 121
a2ec1996098c7d drivers/pci/host/pcie-hisi.c Dongdong Liu 2017-02-06 122 res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
a2ec1996098c7d drivers/pci/host/pcie-hisi.c Dongdong Liu 2017-02-06 123 if (!res) {
a2ec1996098c7d drivers/pci/host/pcie-hisi.c Dongdong Liu 2017-02-06 124 dev_err(dev, "missing \"reg[1]\"property\n");
a2ec1996098c7d drivers/pci/host/pcie-hisi.c Dongdong Liu 2017-02-06 125 return -EINVAL;
a2ec1996098c7d drivers/pci/host/pcie-hisi.c Dongdong Liu 2017-02-06 126 }
a2ec1996098c7d drivers/pci/host/pcie-hisi.c Dongdong Liu 2017-02-06 127
e313a447e73527 drivers/pci/dwc/pcie-hisi.c Lorenzo Pieralisi 2017-04-19 128 reg_base = devm_pci_remap_cfgspace(dev, res->start, resource_size(res));
a2ec1996098c7d drivers/pci/host/pcie-hisi.c Dongdong Liu 2017-02-06 129 if (!reg_base)
a2ec1996098c7d drivers/pci/host/pcie-hisi.c Dongdong Liu 2017-02-06 130 return -ENOMEM;
a2ec1996098c7d drivers/pci/host/pcie-hisi.c Dongdong Liu 2017-02-06 131
a2ec1996098c7d drivers/pci/host/pcie-hisi.c Dongdong Liu 2017-02-06 @132 cfg->priv = reg_base;
a2ec1996098c7d drivers/pci/host/pcie-hisi.c Dongdong Liu 2017-02-06 133 return 0;
a2ec1996098c7d drivers/pci/host/pcie-hisi.c Dongdong Liu 2017-02-06 134 }
a2ec1996098c7d drivers/pci/host/pcie-hisi.c Dongdong Liu 2017-02-06 135

:::::: The code at line 61 was first introduced by commit
:::::: 5f00f1a0178cf52928366a5e1f376a65f1f3f389 PCI: Add MCFG quirks for HiSilicon Hip05/06/07 host controllers

:::::: TO: Dongdong Liu <liudongdong3@xxxxxxxxxx>
:::::: CC: Bjorn Helgaas <helgaas@xxxxxxxxxx>

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