Commit 479a99a8 authored by Davidlohr Bueso's avatar Davidlohr Bueso Committed by Ingo Molnar

x86/srat: Simplify memory affinity init error handling

The acpi_numa_memory_affinity_init() function can fail in
several scenarios, use a single point of error return.
Signed-off-by: default avatarDavidlohr Bueso <davidlohr.bueso@hp.com>
Link: http://lkml.kernel.org/r/1357690721.1890.15.camel@buesod1.americas.hpqcorp.net
[ Cleaned up the label naming a bit. ]
Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent b9975dab
...@@ -149,39 +149,40 @@ acpi_numa_memory_affinity_init(struct acpi_srat_mem_affinity *ma) ...@@ -149,39 +149,40 @@ acpi_numa_memory_affinity_init(struct acpi_srat_mem_affinity *ma)
int node, pxm; int node, pxm;
if (srat_disabled()) if (srat_disabled())
return -1; goto out_err;
if (ma->header.length != sizeof(struct acpi_srat_mem_affinity)) { if (ma->header.length != sizeof(struct acpi_srat_mem_affinity))
bad_srat(); goto out_err_bad_srat;
return -1;
}
if ((ma->flags & ACPI_SRAT_MEM_ENABLED) == 0) if ((ma->flags & ACPI_SRAT_MEM_ENABLED) == 0)
return -1; goto out_err;
if ((ma->flags & ACPI_SRAT_MEM_HOT_PLUGGABLE) && !save_add_info()) if ((ma->flags & ACPI_SRAT_MEM_HOT_PLUGGABLE) && !save_add_info())
return -1; goto out_err;
start = ma->base_address; start = ma->base_address;
end = start + ma->length; end = start + ma->length;
pxm = ma->proximity_domain; pxm = ma->proximity_domain;
if (acpi_srat_revision <= 1) if (acpi_srat_revision <= 1)
pxm &= 0xff; pxm &= 0xff;
node = setup_node(pxm); node = setup_node(pxm);
if (node < 0) { if (node < 0) {
printk(KERN_ERR "SRAT: Too many proximity domains.\n"); printk(KERN_ERR "SRAT: Too many proximity domains.\n");
bad_srat(); goto out_err_bad_srat;
return -1;
} }
if (numa_add_memblk(node, start, end) < 0) { if (numa_add_memblk(node, start, end) < 0)
bad_srat(); goto out_err_bad_srat;
return -1;
}
node_set(node, numa_nodes_parsed); node_set(node, numa_nodes_parsed);
printk(KERN_INFO "SRAT: Node %u PXM %u [mem %#010Lx-%#010Lx]\n", printk(KERN_INFO "SRAT: Node %u PXM %u [mem %#010Lx-%#010Lx]\n",
node, pxm, node, pxm,
(unsigned long long) start, (unsigned long long) end - 1); (unsigned long long) start, (unsigned long long) end - 1);
return 0; return 0;
out_err_bad_srat:
bad_srat();
out_err:
return -1;
} }
void __init acpi_numa_arch_fixup(void) {} void __init acpi_numa_arch_fixup(void) {}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment