diff options
author | Davidlohr Bueso <davidlohr.bueso@hp.com> | 2013-01-08 19:18:41 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2013-01-24 08:20:00 -0500 |
commit | 479a99a8e510c8839e0d3d3de8391f8bc61b9760 (patch) | |
tree | 92aa079da4ac8d0f92e638f745ea193eb1d8a7ed /arch/x86/mm/srat.c | |
parent | b9975dabe3f0a6e4d1af52c47f66b5558df207a3 (diff) |
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: Davidlohr 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: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch/x86/mm/srat.c')
-rw-r--r-- | arch/x86/mm/srat.c | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/arch/x86/mm/srat.c b/arch/x86/mm/srat.c index 4ddf497ca65b..cdd0da9dd530 100644 --- a/arch/x86/mm/srat.c +++ b/arch/x86/mm/srat.c | |||
@@ -149,39 +149,40 @@ acpi_numa_memory_affinity_init(struct acpi_srat_mem_affinity *ma) | |||
149 | int node, pxm; | 149 | int node, pxm; |
150 | 150 | ||
151 | if (srat_disabled()) | 151 | if (srat_disabled()) |
152 | return -1; | 152 | goto out_err; |
153 | if (ma->header.length != sizeof(struct acpi_srat_mem_affinity)) { | 153 | if (ma->header.length != sizeof(struct acpi_srat_mem_affinity)) |
154 | bad_srat(); | 154 | goto out_err_bad_srat; |
155 | return -1; | ||
156 | } | ||
157 | if ((ma->flags & ACPI_SRAT_MEM_ENABLED) == 0) | 155 | if ((ma->flags & ACPI_SRAT_MEM_ENABLED) == 0) |
158 | return -1; | 156 | goto out_err; |
159 | |||
160 | if ((ma->flags & ACPI_SRAT_MEM_HOT_PLUGGABLE) && !save_add_info()) | 157 | if ((ma->flags & ACPI_SRAT_MEM_HOT_PLUGGABLE) && !save_add_info()) |
161 | return -1; | 158 | goto out_err; |
159 | |||
162 | start = ma->base_address; | 160 | start = ma->base_address; |
163 | end = start + ma->length; | 161 | end = start + ma->length; |
164 | pxm = ma->proximity_domain; | 162 | pxm = ma->proximity_domain; |
165 | if (acpi_srat_revision <= 1) | 163 | if (acpi_srat_revision <= 1) |
166 | pxm &= 0xff; | 164 | pxm &= 0xff; |
165 | |||
167 | node = setup_node(pxm); | 166 | node = setup_node(pxm); |
168 | if (node < 0) { | 167 | if (node < 0) { |
169 | printk(KERN_ERR "SRAT: Too many proximity domains.\n"); | 168 | printk(KERN_ERR "SRAT: Too many proximity domains.\n"); |
170 | bad_srat(); | 169 | goto out_err_bad_srat; |
171 | return -1; | ||
172 | } | 170 | } |
173 | 171 | ||
174 | if (numa_add_memblk(node, start, end) < 0) { | 172 | if (numa_add_memblk(node, start, end) < 0) |
175 | bad_srat(); | 173 | goto out_err_bad_srat; |
176 | return -1; | ||
177 | } | ||
178 | 174 | ||
179 | node_set(node, numa_nodes_parsed); | 175 | node_set(node, numa_nodes_parsed); |
180 | 176 | ||
181 | printk(KERN_INFO "SRAT: Node %u PXM %u [mem %#010Lx-%#010Lx]\n", | 177 | printk(KERN_INFO "SRAT: Node %u PXM %u [mem %#010Lx-%#010Lx]\n", |
182 | node, pxm, | 178 | node, pxm, |
183 | (unsigned long long) start, (unsigned long long) end - 1); | 179 | (unsigned long long) start, (unsigned long long) end - 1); |
180 | |||
184 | return 0; | 181 | return 0; |
182 | out_err_bad_srat: | ||
183 | bad_srat(); | ||
184 | out_err: | ||
185 | return -1; | ||
185 | } | 186 | } |
186 | 187 | ||
187 | void __init acpi_numa_arch_fixup(void) {} | 188 | void __init acpi_numa_arch_fixup(void) {} |