[mchinth: sep_socwatch_linux_5_9 32/41] drivers/platform/x86/sepdk/sep/pci.c:365:17: sparse: sparse: cast removes address space '__iomem' of expression

From: kernel test robot
Date: Sat Jul 31 2021 - 03:00:30 EST


tree: https://github.com/mchinth/linux  sep_socwatch_linux_5_9
head: 7296486889985b9d9895a39f551764a4b0425bea
commit: 4a8adda8065c4c6944ffedd3025605c845c262a5 [32/41] SEP/SOCWATCH resolve build errors after rebasing to linux v5.6-rc3
config: i386-randconfig-s032-20210730 (attached as .config)
compiler: gcc-10 (Ubuntu 10.3.0-1ubuntu1~20.04) 10.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.3-341-g8af24329-dirty
# https://github.com/mchinth/linux/commit/4a8adda8065c4c6944ffedd3025605c845c262a5
git remote add mchinth https://github.com/mchinth/linux
git fetch --no-tags mchinth  sep_socwatch_linux_5_9
git checkout 4a8adda8065c4c6944ffedd3025605c845c262a5
# save the attached .config to linux build tree
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=i386 SHELL=/bin/bash drivers/platform/x86/sepdk/sep/

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/platform/x86/sepdk/sep/pci.c:365:17: sparse: sparse: cast removes address space '__iomem' of expression
drivers/platform/x86/sepdk/sep/pci.c:417:17: sparse: sparse: cast removes address space '__iomem' of expression
drivers/platform/x86/sepdk/sep/pci.c:462:16: sparse: sparse: cast removes address space '__iomem' of expression

vim +/__iomem +365 drivers/platform/x86/sepdk/sep/pci.c

334
335 /* ------------------------------------------------------------------------- */
336 /*!
337 * @fn extern int PCI_Read_From_Memory_Address(addr, val)
338 *
339 * @param addr - physical address in mmio
340 * @param *value - value at this address
341 *
342 * @return status
343 *
344 * @brief Read memory mapped i/o physical location
345 *
346 */
347 int PCI_Read_From_Memory_Address(U32 addr, U32 *val)
348 {
349 U32 aligned_addr, offset, value;
350 PVOID base;
351
352 SEP_DRV_LOG_TRACE_IN("Addr: %x, val_pointer: %p.", addr, val);
353
354 if (addr <= 0) {
355 SEP_DRV_LOG_ERROR_TRACE_OUT("OS_INVALID (addr <= 0!).");
356 return OS_INVALID;
357 }
358
359 SEP_DRV_LOG_TRACE("Preparing to reading physical address: %x.", addr);
360 offset = addr & ~PAGE_MASK;
361 aligned_addr = addr & PAGE_MASK;
362 SEP_DRV_LOG_TRACE("Aligned physical address: %x, offset: %x.",
363 aligned_addr, offset);
364
> 365 base = (PVOID)ioremap_cache(aligned_addr, PAGE_SIZE);
366 if (base == NULL) {
367 SEP_DRV_LOG_ERROR_TRACE_OUT("OS_INVALID (mapping failed!).");
368 return OS_INVALID;
369 }
370
371 SEP_DRV_LOG_REGISTER_IN("Will read PCI address %u (mapped at %p).",
372 addr, base + offset);
373 value = readl((void __iomem *)(base + offset));
374 SEP_DRV_LOG_REGISTER_OUT("Read PCI address %u (mapped at %p): %x.",
375 addr, base + offset, value);
376
377 *val = value;
378
379 iounmap((void __iomem *)base);
380
381 SEP_DRV_LOG_TRACE_OUT("OS_SUCCESS.");
382 return OS_SUCCESS;
383 }
384

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

Attachment: .config.gz
Description: application/gzip