arch/arm/mach-rockchip/pm.c:277:9: sparse: sparse: incorrect type in argument 1 (different address spaces)
From: kernel test robot
Date: Sun Aug 14 2022 - 04:22:34 EST
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: aea23e7c464bfdec04b52cf61edb62030e9e0d0a
commit: f68f2ff91512c199ec24883001245912afc17873 fortify: Detect struct member overflows in memcpy() at compile-time
date: 6 months ago
config: arm-randconfig-s031-20220801 (https://download.01.org/0day-ci/archive/20220814/202208141642.ISeeSDiu-lkp@xxxxxxxxx/config)
compiler: arm-linux-gnueabi-gcc (GCC) 12.1.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-39-gce1a6720-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=f68f2ff91512c199ec24883001245912afc17873
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout f68f2ff91512c199ec24883001245912afc17873
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=arm SHELL=/bin/bash
If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@xxxxxxxxx>
sparse warnings: (new ones prefixed by >>)
>> arch/arm/mach-rockchip/pm.c:277:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const * @@ got void [noderef] __iomem *static [assigned] [toplevel] rk3288_bootram_base @@
arch/arm/mach-rockchip/pm.c:277:9: sparse: expected void const *
arch/arm/mach-rockchip/pm.c:277:9: sparse: got void [noderef] __iomem *static [assigned] [toplevel] rk3288_bootram_base
>> arch/arm/mach-rockchip/pm.c:277:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const * @@ got void [noderef] __iomem *static [assigned] [toplevel] rk3288_bootram_base @@
arch/arm/mach-rockchip/pm.c:277:9: sparse: expected void const *
arch/arm/mach-rockchip/pm.c:277:9: sparse: got void [noderef] __iomem *static [assigned] [toplevel] rk3288_bootram_base
arch/arm/mach-rockchip/pm.c:277:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void * @@ got void [noderef] __iomem *static [assigned] [toplevel] rk3288_bootram_base @@
arch/arm/mach-rockchip/pm.c:277:9: sparse: expected void *
arch/arm/mach-rockchip/pm.c:277:9: sparse: got void [noderef] __iomem *static [assigned] [toplevel] rk3288_bootram_base
--
arch/arm/mach-tegra/reset.c:64:9: sparse: sparse: subtraction of functions? Share your drugs
arch/arm/mach-tegra/reset.c:66:9: sparse: sparse: subtraction of functions? Share your drugs
>> arch/arm/mach-tegra/reset.c:66:9: sparse: sparse: cast from unknown type
vim +277 arch/arm/mach-rockchip/pm.c
9c1ec8e18c210092 Chris Zhong 2014-12-01 223
2dd00d31d488707d Douglas Anderson 2019-04-11 224 static int __init rk3288_suspend_init(struct device_node *np)
9c1ec8e18c210092 Chris Zhong 2014-12-01 225 {
9c1ec8e18c210092 Chris Zhong 2014-12-01 226 struct device_node *sram_np;
9c1ec8e18c210092 Chris Zhong 2014-12-01 227 struct resource res;
9c1ec8e18c210092 Chris Zhong 2014-12-01 228 int ret;
9c1ec8e18c210092 Chris Zhong 2014-12-01 229
9c1ec8e18c210092 Chris Zhong 2014-12-01 230 pmu_regmap = syscon_node_to_regmap(np);
9c1ec8e18c210092 Chris Zhong 2014-12-01 231 if (IS_ERR(pmu_regmap)) {
9c1ec8e18c210092 Chris Zhong 2014-12-01 232 pr_err("%s: could not find pmu regmap\n", __func__);
9c1ec8e18c210092 Chris Zhong 2014-12-01 233 return PTR_ERR(pmu_regmap);
9c1ec8e18c210092 Chris Zhong 2014-12-01 234 }
9c1ec8e18c210092 Chris Zhong 2014-12-01 235
9c1ec8e18c210092 Chris Zhong 2014-12-01 236 sgrf_regmap = syscon_regmap_lookup_by_compatible(
9c1ec8e18c210092 Chris Zhong 2014-12-01 237 "rockchip,rk3288-sgrf");
9c1ec8e18c210092 Chris Zhong 2014-12-01 238 if (IS_ERR(sgrf_regmap)) {
9c1ec8e18c210092 Chris Zhong 2014-12-01 239 pr_err("%s: could not find sgrf regmap\n", __func__);
2a03c025fdea25a4 Fabio Estevam 2015-08-13 240 return PTR_ERR(sgrf_regmap);
9c1ec8e18c210092 Chris Zhong 2014-12-01 241 }
9c1ec8e18c210092 Chris Zhong 2014-12-01 242
134f1f609bdf2f67 Chris Zhong 2015-06-23 243 grf_regmap = syscon_regmap_lookup_by_compatible(
134f1f609bdf2f67 Chris Zhong 2015-06-23 244 "rockchip,rk3288-grf");
134f1f609bdf2f67 Chris Zhong 2015-06-23 245 if (IS_ERR(grf_regmap)) {
134f1f609bdf2f67 Chris Zhong 2015-06-23 246 pr_err("%s: could not find grf regmap\n", __func__);
2a03c025fdea25a4 Fabio Estevam 2015-08-13 247 return PTR_ERR(grf_regmap);
134f1f609bdf2f67 Chris Zhong 2015-06-23 248 }
134f1f609bdf2f67 Chris Zhong 2015-06-23 249
9c1ec8e18c210092 Chris Zhong 2014-12-01 250 sram_np = of_find_compatible_node(NULL, NULL,
9c1ec8e18c210092 Chris Zhong 2014-12-01 251 "rockchip,rk3288-pmu-sram");
9c1ec8e18c210092 Chris Zhong 2014-12-01 252 if (!sram_np) {
9c1ec8e18c210092 Chris Zhong 2014-12-01 253 pr_err("%s: could not find bootram dt node\n", __func__);
9c1ec8e18c210092 Chris Zhong 2014-12-01 254 return -ENODEV;
9c1ec8e18c210092 Chris Zhong 2014-12-01 255 }
9c1ec8e18c210092 Chris Zhong 2014-12-01 256
9c1ec8e18c210092 Chris Zhong 2014-12-01 257 rk3288_bootram_base = of_iomap(sram_np, 0);
9c1ec8e18c210092 Chris Zhong 2014-12-01 258 if (!rk3288_bootram_base) {
9c1ec8e18c210092 Chris Zhong 2014-12-01 259 pr_err("%s: could not map bootram base\n", __func__);
c2af88f1a0cdf4cb Wen Yang 2019-04-26 260 of_node_put(sram_np);
9c1ec8e18c210092 Chris Zhong 2014-12-01 261 return -ENOMEM;
9c1ec8e18c210092 Chris Zhong 2014-12-01 262 }
9c1ec8e18c210092 Chris Zhong 2014-12-01 263
9c1ec8e18c210092 Chris Zhong 2014-12-01 264 ret = of_address_to_resource(sram_np, 0, &res);
9c1ec8e18c210092 Chris Zhong 2014-12-01 265 if (ret) {
9c1ec8e18c210092 Chris Zhong 2014-12-01 266 pr_err("%s: could not get bootram phy addr\n", __func__);
c2af88f1a0cdf4cb Wen Yang 2019-04-26 267 of_node_put(sram_np);
9c1ec8e18c210092 Chris Zhong 2014-12-01 268 return ret;
9c1ec8e18c210092 Chris Zhong 2014-12-01 269 }
9c1ec8e18c210092 Chris Zhong 2014-12-01 270 rk3288_bootram_phy = res.start;
9c1ec8e18c210092 Chris Zhong 2014-12-01 271
9c1ec8e18c210092 Chris Zhong 2014-12-01 272 of_node_put(sram_np);
9c1ec8e18c210092 Chris Zhong 2014-12-01 273
9c1ec8e18c210092 Chris Zhong 2014-12-01 274 rk3288_config_bootdata();
9c1ec8e18c210092 Chris Zhong 2014-12-01 275
9c1ec8e18c210092 Chris Zhong 2014-12-01 276 /* copy resume code and data to bootsram */
9c1ec8e18c210092 Chris Zhong 2014-12-01 @277 memcpy(rk3288_bootram_base, rockchip_slp_cpu_resume,
9c1ec8e18c210092 Chris Zhong 2014-12-01 278 rk3288_bootram_sz);
9c1ec8e18c210092 Chris Zhong 2014-12-01 279
9c1ec8e18c210092 Chris Zhong 2014-12-01 280 return 0;
9c1ec8e18c210092 Chris Zhong 2014-12-01 281 }
9c1ec8e18c210092 Chris Zhong 2014-12-01 282
:::::: The code at line 277 was first introduced by commit
:::::: 9c1ec8e18c210092418d27278a742a2a98eafffe ARM: rockchip: add suspend and resume for RK3288
:::::: TO: Chris Zhong <zyw@xxxxxxxxxxxxxx>
:::::: CC: Heiko Stuebner <heiko@xxxxxxxxx>
--
0-DAY CI Kernel Test Service
https://01.org/lkp