]> www.infradead.org Git - users/jedix/linux-maple.git/commit
asm-generic/io.h: warn in inb() and friends with undefined PCI_IOBASE
authorNiklas Schnelle <schnelle@linux.ibm.com>
Mon, 10 May 2021 14:52:34 +0000 (16:52 +0200)
committerArnd Bergmann <arnd@arndb.de>
Mon, 10 May 2021 15:37:55 +0000 (17:37 +0200)
commit5ae6eadfdaf431f47adbdf1754f3b5a5fd638de2
tree95ab64835696f08b024ab70028807717a3bd5636
parent78924148a3d22e030fe8f5c1a0ce10e177856423
asm-generic/io.h: warn in inb() and friends with undefined PCI_IOBASE

When PCI_IOBASE is not defined, it is set to 0 such that it is ignored
in calls to the readX/writeX primitives. This triggers clang's
-Wnull-pointer-arithmetic warning and will result in illegal accesses on
platforms that do not support I/O ports.

Make things explicit and silence the warning by letting inb() and
friends fail with WARN_ONCE() and a 0xff... return in case PCI_IOBASE is
not defined.

Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
Link: https://lore.kernel.org/lkml/20210421111759.2059976-1-schnelle@linux.ibm.com/
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
include/asm-generic/io.h