drivers/platform/x86/intel/pmc/core_ssram.c:98:25: sparse: sparse: incorrect type in argument 1 (different address spaces)

From: kernel test robot
Date: Mon Mar 04 2024 - 16:25:31 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 90d35da658da8cff0d4ecbb5113f5fac9d00eb72
commit: a01486dc4bb17de976c6d0a4b1ad5f8106525dfb platform/x86/intel/pmc: Cleanup SSRAM discovery
date: 3 months ago
config: x86_64-randconfig-r111-20240304 (https://download.01.org/0day-ci/archive/20240305/202403050547.qnZtuNlN-lkp@xxxxxxxxx/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240305/202403050547.qnZtuNlN-lkp@xxxxxxxxx/reproduce)

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@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202403050547.qnZtuNlN-lkp@xxxxxxxxx/

sparse warnings: (new ones prefixed by >>)
>> drivers/platform/x86/intel/pmc/core_ssram.c:98:25: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile *val @@ got void [noderef] __iomem *__val @@
drivers/platform/x86/intel/pmc/core_ssram.c:98:25: sparse: expected void const volatile *val
drivers/platform/x86/intel/pmc/core_ssram.c:98:25: sparse: got void [noderef] __iomem *__val

vim +98 drivers/platform/x86/intel/pmc/core_ssram.c

70
71 static int
72 pmc_core_ssram_get_pmc(struct pmc_dev *pmcdev, int pmc_idx, u32 offset)
73 {
74 struct pci_dev *ssram_pcidev = pmcdev->ssram_pcidev;
75 void __iomem __free(pmc_core_iounmap) *tmp_ssram = NULL;
76 void __iomem __free(pmc_core_iounmap) *ssram = NULL;
77 const struct pmc_reg_map *map;
78 u64 ssram_base, pwrm_base;
79 u16 devid;
80
81 if (!pmcdev->regmap_list)
82 return -ENOENT;
83
84 ssram_base = ssram_pcidev->resource[0].start;
85 tmp_ssram = ioremap(ssram_base, SSRAM_HDR_SIZE);
86
87 if (pmc_idx != PMC_IDX_MAIN) {
88 /*
89 * The secondary PMC BARS (which are behind hidden PCI devices)
90 * are read from fixed offsets in MMIO of the primary PMC BAR.
91 */
92 ssram_base = get_base(tmp_ssram, offset);
93 ssram = ioremap(ssram_base, SSRAM_HDR_SIZE);
94 if (!ssram)
95 return -ENOMEM;
96
97 } else {
> 98 ssram = no_free_ptr(tmp_ssram);
99 }
100
101 pwrm_base = get_base(ssram, SSRAM_PWRM_OFFSET);
102 devid = readw(ssram + SSRAM_DEVID_OFFSET);
103
104 map = pmc_core_find_regmap(pmcdev->regmap_list, devid);
105 if (!map)
106 return -ENODEV;
107
108 return pmc_core_pmc_add(pmcdev, pwrm_base, map, PMC_IDX_MAIN);
109 }
110

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki