===================================================================
@@ -638,17 +638,17 @@ acpi_os_read_memory(acpi_physical_addres
{
u32 dummy;
void __iomem *virt_addr;
- int size = width / 8, unmap = 0;
+
+ if (!value)
+ value = &dummy;
rcu_read_lock();
- virt_addr = acpi_map_vaddr_lookup(phys_addr, size);
- rcu_read_unlock();
+ virt_addr = acpi_map_vaddr_lookup(phys_addr, width / 8);
if (!virt_addr) {
- virt_addr = acpi_os_ioremap(phys_addr, size);
- unmap = 1;
+ rcu_read_unlock();
+ WARN(true, "Address not mapped: %llx\n", phys_addr);
+ return AE_BAD_ADDRESS;
}
- if (!value)
- value = &dummy;
switch (width) {
case 8:
@@ -663,9 +663,7 @@ acpi_os_read_memory(acpi_physical_addres
default:
BUG();
}
-
- if (unmap)
- iounmap(virt_addr);
+ rcu_read_unlock();
return AE_OK;
}
@@ -674,14 +672,13 @@ acpi_status
acpi_os_write_memory(acpi_physical_address phys_addr, u32 value, u32 width)
{
void __iomem *virt_addr;
- int size = width / 8, unmap = 0;
rcu_read_lock();
- virt_addr = acpi_map_vaddr_lookup(phys_addr, size);
- rcu_read_unlock();
+ virt_addr = acpi_map_vaddr_lookup(phys_addr, width / 8);
if (!virt_addr) {
- virt_addr = acpi_os_ioremap(phys_addr, size);
- unmap = 1;
+ rcu_read_unlock();
+ WARN(true, "Address not mapped: %llx\n", phys_addr);
+ return AE_BAD_ADDRESS;
}
switch (width) {
@@ -697,9 +694,7 @@ acpi_os_write_memory(acpi_physical_addre
default:
BUG();
}
-
- if (unmap)
- iounmap(virt_addr);
+ rcu_read_unlock();
return AE_OK;
}