[PATCH v3 0/3] asm-generic/io.h: Silence -Wnull-pointer-arithmetic warning on PCI_IOBASE

Niklas Schnelle schnelle at linux.ibm.com
Wed Apr 21 12:17:56 BST 2021


Hi,

This is version 3 of my attempt to get rid of a clang -Wnull-pointer-arithmetic
warning for the use of PCI_IOBASE in asm-generic/io.h. This was originally
found on s390 but should apply to all platforms leaving PCI_IOBASE undefined
while making use of the inb() and friends helpers from asm-generic/io.h.

This applies cleanly and was compile tested on top of v5.12-rc8 for the
previously broken ARC and nds32 architectures.

I did boot test this only on x86_64 and s390x the former implements inb()
itself while the latter would emit a WARN_ONCE() but no drivers using inb().

Thanks,
Niklas

Changes since v2:
- Improved comment for SPARC PCI_IOBASE definition as suggested by David Laight
- Added a patch for ARC which is missing the asm/bug.h include for WARN_ONCE()
  (kernel test robot)
- Added ifdefs to ioport_map() and __pci_ioport_map() since apparently at least
  test configs enable CONFIG_HAS_IOPORT_MAP even on architectures which leave
  PCI_IOBASE unset (kernel test robot for nds32 and ARC).

Changes since v1:
- Added patch to explicitly set PCI_IOBASE to 0 on sparc as suggested by Arnd
  Bergmann
- Instead of working around the warning with a uintptr_t PCI_IOBASE make inb()
  and friends explicitly WARN_ONCE() and return 0xff... (Arnd Bergmann)

Niklas Schnelle (3):
  sparc: explicitly set PCI_IOBASE to 0
  ARC: io.h: Include asm/bug.h
  asm-generic/io.h: Silence -Wnull-pointer-arithmetic warning on
    PCI_IOBASE

 arch/arc/include/asm/io.h   |  1 +
 arch/sparc/include/asm/io.h |  8 +++++
 include/asm-generic/io.h    | 64 ++++++++++++++++++++++++++++++++++---
 3 files changed, 69 insertions(+), 4 deletions(-)

-- 
2.25.1




More information about the linux-snps-arc mailing list