Skip to contentSkip to conversation

vfio/pci: Fix sparse warning in vfio_pci_core_get_iomap()

PATCH Applied Matt Evans 2 participants 2 messages May 22

Subsystems (2)
lore
Share & tools
lore

Matt Evans

author
#0 lore raw

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()")
---
 include/linux/vfio_pci_core.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
include/linux/vfio_pci_core.h +2 -2
index 7accd0eac457..4fa129fc5c64 100644
@@ -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
maintainer Applied
#1 lore raw
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 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()")
---
 include/linux/vfio_pci_core.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
include/linux/vfio_pci_core.h +0 -0
index 7accd0eac457..4fa129fc5c64 100644
@@ -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 -2
 	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];
 }

Applied to vfio next branch for v7.2. Thanks,

Alex