[PATCH] RISC-V: ACPI: fix two __iomem cast warnings

Ben Dooks posted 1 patch 3 weeks, 6 days ago
arch/riscv/kernel/acpi.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[PATCH] RISC-V: ACPI: fix two __iomem cast warnings
Posted by Ben Dooks 3 weeks, 6 days ago
The __acpi_map_table() and __acpi_unmap_table() return and
take __iomem tagged pointers. Add a cast to fix the sparse
warnings:

arch/riscv/kernel/acpi.c:216:30: warning: incorrect type in return expression (different address spaces)
arch/riscv/kernel/acpi.c:216:30:    expected void [noderef] __iomem *
arch/riscv/kernel/acpi.c:216:30:    got void *
arch/riscv/kernel/acpi.c:224:24: warning: incorrect type in argument 1 (different address spaces)
arch/riscv/kernel/acpi.c:224:24:    expected void *addr
arch/riscv/kernel/acpi.c:224:24:    got void [noderef] __iomem *map

Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
---
 arch/riscv/kernel/acpi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/riscv/kernel/acpi.c b/arch/riscv/kernel/acpi.c
index 71698ee11621..0d52942f94d5 100644
--- a/arch/riscv/kernel/acpi.c
+++ b/arch/riscv/kernel/acpi.c
@@ -213,7 +213,7 @@ void __init __iomem *__acpi_map_table(unsigned long phys, unsigned long size)
 	if (!size)
 		return NULL;
 
-	return early_memremap(phys, size);
+	return (void __iomem *)early_memremap(phys, size);
 }
 
 void __init __acpi_unmap_table(void __iomem *map, unsigned long size)
@@ -221,7 +221,7 @@ void __init __acpi_unmap_table(void __iomem *map, unsigned long size)
 	if (!map || !size)
 		return;
 
-	early_memunmap(map, size);
+	early_memunmap((void __force *)map, size);
 }
 
 void __iomem *acpi_os_ioremap(acpi_physical_address phys, acpi_size size)
-- 
2.37.2.352.g3c44437643
Re: [PATCH] RISC-V: ACPI: fix two __iomem cast warnings
Posted by Paul Walmsley 4 days, 22 hours ago
Hi Ben,

On Wed, 11 Mar 2026, Ben Dooks wrote:

> The __acpi_map_table() and __acpi_unmap_table() return and
> take __iomem tagged pointers. Add a cast to fix the sparse
> warnings:
> 
> arch/riscv/kernel/acpi.c:216:30: warning: incorrect type in return expression (different address spaces)
> arch/riscv/kernel/acpi.c:216:30:    expected void [noderef] __iomem *
> arch/riscv/kernel/acpi.c:216:30:    got void *
> arch/riscv/kernel/acpi.c:224:24: warning: incorrect type in argument 1 (different address spaces)
> arch/riscv/kernel/acpi.c:224:24:    expected void *addr
> arch/riscv/kernel/acpi.c:224:24:    got void [noderef] __iomem *map
> 
> Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>

Thanks for taking a look at this.  It appears that some of the other 
architectures have the same issue.  Could you come up with a series that 
addresses the others as well?  You might need to get the ACPI folks 
involved; it's not really clear to me why __acpi_map_table() needs to 
return an __iomem *.


- Paul