diff mbox

[1/2,Patch-next,-v2] ACPI, APEI Fix the return value(==NULL) of acpi_pre_map().

Message ID 4C6B1F63.9050703@np.css.fujitsu.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jin Dongming Aug. 17, 2010, 11:46 p.m. UTC
None
diff mbox

Patch

diff --git a/drivers/acpi/atomicio.c b/drivers/acpi/atomicio.c
index 8f8bd73..1bc2614 100644
--- a/drivers/acpi/atomicio.c
+++ b/drivers/acpi/atomicio.c
@@ -133,7 +133,7 @@  static void __iomem *acpi_pre_map(phys_addr_t paddr,
 
 	spin_lock_irqsave(&acpi_iomaps_lock, flags);
 	vaddr = __acpi_try_ioremap(paddr, size);
-	if (vaddr) {
+	if (unlikely(vaddr)) {
 		spin_unlock_irqrestore(&acpi_iomaps_lock, flags);
 		iounmap(map->vaddr);
 		kfree(map);
@@ -142,7 +142,7 @@  static void __iomem *acpi_pre_map(phys_addr_t paddr,
 	list_add_tail_rcu(&map->list, &acpi_iomaps);
 	spin_unlock_irqrestore(&acpi_iomaps_lock, flags);
 
-	return vaddr + (paddr - pg_off);
+	return map->vaddr + (paddr - pg_off);
 err_unmap:
 	iounmap(vaddr);
 	return NULL;