vfio/pci: Fix sparse warning in vfio_pci_core_get_iomap()
Subsystems (2)
PATCH 1/1 vfio/pci: Fix sparse warning in vfio_pci_core_get_iomap()
Use IOMEM_ERR_PTR() when returning a void __iomem * rather than ERR_PTR(). This fixes a sparse warning, "different address spaces".
Fixes 859dc0f6253b ("vfio/pci: Replace vfio_pci_core_setup_barmap() with vfio_pci_core_get_iomap()")
Reported-by kernel test robot <[email protected]>
Signed-off-by Matt Evans <[email protected]>
--- include/linux/vfio_pci_core.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
include/linux/vfio_pci_core.h +2 -2
@@ -244,10 +244,10 @@ static inline void __iomem __must_check * vfio_pci_core_get_iomap(struct vfio_pci_core_device *vdev, unsigned int bar) { if (WARN_ON_ONCE(bar >= PCI_STD_NUM_BARS)) - return ERR_PTR(-EINVAL); + return IOMEM_ERR_PTR(-EINVAL);if (WARN_ON_ONCE (!vdev->barmap[bar])) -return ERR_PTR (-ENODEV ); +return IOMEM_ERR_PTR (-ENODEV );return vdev->barmap[bar]; }
Signature · 1 line
2.47.3
Quoted 18 lines · On Fri, 22 May 2026 05:42:11 -0700 Matt Evans <[email protected]> wrote:
Use
IOMEM_ERR_PTR()when returning a void__iomem* rather thanERR_PTR(). This fixes a sparse warning, "different address spaces".Fixes 859dc0f6253b ("vfio/pci: Replace vfio_pci_core_setup_barmap() with vfio_pci_core_get_iomap()")Reported-by kernel test robot <[email protected]>Signed-off-by Matt Evans <[email protected]>--- include/linux/vfio_pci_core.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)include/linux/vfio_pci_core.h +0
-0@@ -244,10 +244,10 @@ static inline void __iomem __must_check * vfio_pci_core_get_iomap(struct vfio_pci_core_device *vdev, unsigned int bar) {
include/linux/vfio_pci_core.h static inline void __iomem __must_check * · line 253
Quoted 10 lines
include/linux/vfio_pci_core.h +2
-2if (WARN_ON_ONCE (bar >=PCI_STD_NUM_BARS )) -return ERR_PTR (-EINVAL ); +return IOMEM_ERR_PTR (-EINVAL );if (WARN_ON_ONCE (!vdev->barmap[bar])) -return ERR_PTR (-ENODEV ); +return IOMEM_ERR_PTR (-ENODEV );return vdev->barmap[bar]; }
Applied to vfio next branch for v7.2. Thanks,
Alex