[PATCH] driver core: device.h: fix incorrect type in return expression

From: xiaopeitux
Date: Wed Jan 22 2025 - 02:40:31 EST


From: Pei Xiao <xiaopei01@xxxxxxxxxx>

sparse warnings:
sparse: incorrect type in return expression, expected void
[noderef] __iomem *, got void *

Fix sparse warnings by use IOMEM_ERR_PTR

Fixes: da7c07b10838 ("driver core: Provide stubs for !IOMEM builds")
Reported-by: kernel test robot <lkp@xxxxxxxxx>
Closes: https://lore.kernel.org/oe-kbuild-all/202501221439.YoPUrrqD-lkp@xxxxxxxxx/
Signed-off-by: Pei Xiao <xiaopei01@xxxxxxxxxx>
---
include/linux/device.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/linux/device.h b/include/linux/device.h
index 667cb6db9019..d76c31b9f9b9 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -378,14 +378,14 @@ static inline
void __iomem *devm_ioremap_resource(struct device *dev,
const struct resource *res)
{
- return ERR_PTR(-EINVAL);
+ return IOMEM_ERR_PTR(-EINVAL);
}

static inline
void __iomem *devm_ioremap_resource_wc(struct device *dev,
const struct resource *res)
{
- return ERR_PTR(-EINVAL);
+ return IOMEM_ERR_PTR(-EINVAL);
}

static inline
@@ -393,7 +393,7 @@ void __iomem *devm_of_iomap(struct device *dev,
struct device_node *node, int index,
resource_size_t *size)
{
- return ERR_PTR(-EINVAL);
+ return IOMEM_ERR_PTR(-EINVAL);
}

#endif
--
2.25.1