arch/powerpc/platforms/powermac/time.c:210:24: sparse: sparse: cast removes address space '__iomem' of expression
From: kernel test robot
Date: Sun Aug 06 2023 - 22:59:40 EST
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 52a93d39b17dc7eb98b6aa3edb93943248e03b2f
commit: 86582e6189dd8f9f52c25d46c70fe5d111da6345 powerpc/powermac: Use early_* IO variants in via_calibrate_decr()
date: 5 days ago
config: powerpc-randconfig-r071-20230807 (https://download.01.org/0day-ci/archive/20230807/202308071025.KCEf7Mhd-lkp@xxxxxxxxx/config)
compiler: powerpc-linux-gcc (GCC) 12.3.0
reproduce: (https://download.01.org/0day-ci/archive/20230807/202308071025.KCEf7Mhd-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/202308071025.KCEf7Mhd-lkp@xxxxxxxxx/
sparse warnings: (new ones prefixed by >>)
>> arch/powerpc/platforms/powermac/time.c:210:24: sparse: sparse: cast removes address space '__iomem' of expression
>> arch/powerpc/platforms/powermac/time.c:210:24: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void [noderef] __iomem *addr @@ got void * @@
arch/powerpc/platforms/powermac/time.c:210:24: sparse: expected void [noderef] __iomem *addr
arch/powerpc/platforms/powermac/time.c:210:24: sparse: got void *
arch/powerpc/platforms/powermac/time.c:192:30: sparse: sparse: dereference of noderef expression
arch/powerpc/platforms/powermac/time.c:192:30: sparse: sparse: dereference of noderef expression
arch/powerpc/platforms/powermac/time.c:196:27: sparse: sparse: cast truncates bits from constant value (b798 becomes 98)
vim +/__iomem +210 arch/powerpc/platforms/powermac/time.c
161
162 #ifdef CONFIG_PPC32
163 /*
164 * Calibrate the decrementer register using VIA timer 1.
165 * This is used both on powermacs and CHRP machines.
166 */
167 static int __init via_calibrate_decr(void)
168 {
169 struct device_node *vias;
170 volatile unsigned char __iomem *via;
171 int count = VIA_TIMER_FREQ_6 / 100;
172 unsigned int dstart, dend;
173 struct resource rsrc;
174
175 vias = of_find_node_by_name(NULL, "via-cuda");
176 if (vias == NULL)
177 vias = of_find_node_by_name(NULL, "via-pmu");
178 if (vias == NULL)
179 vias = of_find_node_by_name(NULL, "via");
180 if (vias == NULL || of_address_to_resource(vias, 0, &rsrc)) {
181 of_node_put(vias);
182 return 0;
183 }
184 of_node_put(vias);
185 via = early_ioremap(rsrc.start, resource_size(&rsrc));
186 if (via == NULL) {
187 printk(KERN_ERR "Failed to map VIA for timer calibration !\n");
188 return 0;
189 }
190
191 /* set timer 1 for continuous interrupts */
192 out_8(&via[ACR], (via[ACR] & ~T1MODE) | T1MODE_CONT);
193 /* set the counter to a small value */
194 out_8(&via[T1CH], 2);
195 /* set the latch to `count' */
196 out_8(&via[T1LL], count);
197 out_8(&via[T1LH], count >> 8);
198 /* wait until it hits 0 */
199 while ((in_8(&via[IFR]) & T1_INT) == 0)
200 ;
201 dstart = get_dec();
202 /* clear the interrupt & wait until it hits 0 again */
203 in_8(&via[T1CL]);
204 while ((in_8(&via[IFR]) & T1_INT) == 0)
205 ;
206 dend = get_dec();
207
208 ppc_tb_freq = (dstart - dend) * 100 / 6;
209
> 210 early_iounmap((void *)via, resource_size(&rsrc));
211
212 return 1;
213 }
214 #endif
215
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki