Skip to contentSkip to conversation

RISC-V: ACPI: fix two __iomem cast warnings

PATCH In review Ben Dooks 2 participants 2 messages Mar 11 – Apr 2 RISC-V

lore
Share & tools
lore

Ben Dooks

author
#0 lore raw

PATCH 1/1 RISC-V: ACPI: fix two __iomem cast warnings

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

---
 arch/riscv/kernel/acpi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/riscv/kernel/acpi.c +2 -2
index 71698ee11621..0d52942f94d5 100644
@@ -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)
Signature · 1 line
2.37.2.352.g3c44437643
maintainer
#1 lore raw

Hi Ben,

Quoted 4 lines · Ben Dooks

The __acpi_map_table() and __acpi_unmap_table() return and take __iomem tagged pointers. Add a cast to fix the sparse warnings:

Quoted 8 lines

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

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