[thermal:thermal/linux-next 46/68] drivers/thermal/broadcom/ns-thermal.c:19:34: sparse: sparse: incorrect type in initializer (different address spaces)

From: kernel test robot
Date: Fri Jul 29 2022 - 02:10:32 EST


tree: git://git.kernel.org/pub/scm/linux/kernel/git/thermal/linux.git thermal/linux-next
head: f0105ae57fe7c05fb82b7c0a6416a34051d29a34
commit: 472eb6fcc74450b922bd79ecd032e4ca2a3f4fe3 [46/68] thermal/drivers/broadcom: Switch to new of API
config: microblaze-randconfig-s032-20220728 (https://download.01.org/0day-ci/archive/20220729/202207291408.QOdXF9af-lkp@xxxxxxxxx/config)
compiler: microblaze-linux-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/thermal/linux.git/commit/?id=472eb6fcc74450b922bd79ecd032e4ca2a3f4fe3
git remote add thermal git://git.kernel.org/pub/scm/linux/kernel/git/thermal/linux.git
git fetch --no-tags thermal thermal/linux-next
git checkout 472eb6fcc74450b922bd79ecd032e4ca2a3f4fe3
# 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=microblaze SHELL=/bin/bash drivers/thermal/broadcom/

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

sparse warnings: (new ones prefixed by >>)
>> drivers/thermal/broadcom/ns-thermal.c:19:34: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected void [noderef] __iomem *pvtmon @@ got void *devdata @@
drivers/thermal/broadcom/ns-thermal.c:19:34: sparse: expected void [noderef] __iomem *pvtmon
drivers/thermal/broadcom/ns-thermal.c:19:34: sparse: got void *devdata
>> drivers/thermal/broadcom/ns-thermal.c:56:44: sparse: sparse: incorrect type in argument 3 (different address spaces) @@ expected void *data @@ got void [noderef] __iomem *[assigned] pvtmon @@
drivers/thermal/broadcom/ns-thermal.c:56:44: sparse: expected void *data
drivers/thermal/broadcom/ns-thermal.c:56:44: sparse: got void [noderef] __iomem *[assigned] pvtmon
drivers/thermal/broadcom/ns-thermal.c:63:36: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void *data @@ got void [noderef] __iomem *[assigned] pvtmon @@
drivers/thermal/broadcom/ns-thermal.c:63:36: sparse: expected void *data
drivers/thermal/broadcom/ns-thermal.c:63:36: sparse: got void [noderef] __iomem *[assigned] pvtmon
>> drivers/thermal/broadcom/ns-thermal.c:70:52: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected void [noderef] __iomem *pvtmon @@ got void * @@
drivers/thermal/broadcom/ns-thermal.c:70:52: sparse: expected void [noderef] __iomem *pvtmon
drivers/thermal/broadcom/ns-thermal.c:70:52: sparse: got void *

vim +19 drivers/thermal/broadcom/ns-thermal.c

16
17 static int ns_thermal_get_temp(struct thermal_zone_device *tz, int *temp)
18 {
> 19 void __iomem *pvtmon = tz->devdata;
20 int offset = thermal_zone_get_offset(tz);
21 int slope = thermal_zone_get_slope(tz);
22 u32 val;
23
24 val = readl(pvtmon + PVTMON_CONTROL0);
25 if ((val & PVTMON_CONTROL0_SEL_MASK) != PVTMON_CONTROL0_SEL_TEMP_MONITOR) {
26 /* Clear current mode selection */
27 val &= ~PVTMON_CONTROL0_SEL_MASK;
28
29 /* Set temp monitor mode (it's the default actually) */
30 val |= PVTMON_CONTROL0_SEL_TEMP_MONITOR;
31
32 writel(val, pvtmon + PVTMON_CONTROL0);
33 }
34
35 val = readl(pvtmon + PVTMON_STATUS);
36 *temp = slope * val + offset;
37
38 return 0;
39 }
40
41 static const struct thermal_zone_device_ops ns_thermal_ops = {
42 .get_temp = ns_thermal_get_temp,
43 };
44
45 static int ns_thermal_probe(struct platform_device *pdev)
46 {
47 struct device *dev = &pdev->dev;
48 struct thermal_zone_device *tz;
49 void __iomem *pvtmon;
50
51 pvtmon = of_iomap(dev_of_node(dev), 0);
52 if (WARN_ON(!pvtmon))
53 return -ENOENT;
54
55 tz = devm_thermal_of_zone_register(dev, 0,
> 56 pvtmon,
57 &ns_thermal_ops);
58 if (IS_ERR(tz)) {
59 iounmap(pvtmon);
60 return PTR_ERR(tz);
61 }
62
63 platform_set_drvdata(pdev, pvtmon);
64
65 return 0;
66 }
67
68 static int ns_thermal_remove(struct platform_device *pdev)
69 {
> 70 void __iomem *pvtmon = platform_get_drvdata(pdev);
71
72 iounmap(pvtmon);
73
74 return 0;
75 }
76

--
0-DAY CI Kernel Test Service
https://01.org/lkp