aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/cpu/microcode
diff options
context:
space:
mode:
authorBorislav Petkov <bp@suse.de>2016-02-03 06:33:43 -0500
committerIngo Molnar <mingo@kernel.org>2016-02-09 05:41:18 -0500
commitf96fde531946524b26d25d4eed9625695837f524 (patch)
tree54eb5324cbf91e13c357b6201e68350d69195fe1 /arch/x86/kernel/cpu/microcode
parent2f303c524ed021825671cfa9b1934338bc04f8ab (diff)
x86/microcode/intel: Cleanup get_matching_model_microcode()
Reflow arguments, sort local variables in reverse christmas tree, kill "out" label. No functionality change. Tested-by: Thomas Voegtle <tv@lio96.de> Signed-off-by: Borislav Petkov <bp@suse.de> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Link: http://lkml.kernel.org/r/1454499225-21544-16-git-send-email-bp@alien8.de Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch/x86/kernel/cpu/microcode')
-rw-r--r--arch/x86/kernel/cpu/microcode/intel.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/arch/x86/kernel/cpu/microcode/intel.c b/arch/x86/kernel/cpu/microcode/intel.c
index 0c67fd060680..cb397947f688 100644
--- a/arch/x86/kernel/cpu/microcode/intel.c
+++ b/arch/x86/kernel/cpu/microcode/intel.c
@@ -287,19 +287,17 @@ static unsigned int _save_mc(struct microcode_intel **mc_saved,
287 * BSP can stay in the platform. 287 * BSP can stay in the platform.
288 */ 288 */
289static enum ucode_state __init 289static enum ucode_state __init
290get_matching_model_microcode(unsigned long start, 290get_matching_model_microcode(unsigned long start, void *data, size_t size,
291 void *data, size_t size, 291 struct mc_saved_data *mcs, unsigned long *mc_ptrs,
292 struct mc_saved_data *mcs,
293 unsigned long *mc_ptrs,
294 struct ucode_cpu_info *uci) 292 struct ucode_cpu_info *uci)
295{ 293{
296 u8 *ucode_ptr = data;
297 unsigned int leftover = size;
298 enum ucode_state state = UCODE_OK;
299 unsigned int mc_size;
300 struct microcode_header_intel *mc_header;
301 struct microcode_intel *mc_saved_tmp[MAX_UCODE_COUNT]; 294 struct microcode_intel *mc_saved_tmp[MAX_UCODE_COUNT];
295 struct microcode_header_intel *mc_header;
302 unsigned int num_saved = mcs->num_saved; 296 unsigned int num_saved = mcs->num_saved;
297 enum ucode_state state = UCODE_OK;
298 unsigned int leftover = size;
299 u8 *ucode_ptr = data;
300 unsigned int mc_size;
303 int i; 301 int i;
304 302
305 while (leftover && num_saved < ARRAY_SIZE(mc_saved_tmp)) { 303 while (leftover && num_saved < ARRAY_SIZE(mc_saved_tmp)) {
@@ -321,8 +319,7 @@ get_matching_model_microcode(unsigned long start,
321 * the platform, we need to find and save microcode patches 319 * the platform, we need to find and save microcode patches
322 * with the same family and model as the BSP. 320 * with the same family and model as the BSP.
323 */ 321 */
324 if (matching_model_microcode(mc_header, uci->cpu_sig.sig) != 322 if (matching_model_microcode(mc_header, uci->cpu_sig.sig) != UCODE_OK) {
325 UCODE_OK) {
326 ucode_ptr += mc_size; 323 ucode_ptr += mc_size;
327 continue; 324 continue;
328 } 325 }
@@ -334,19 +331,19 @@ get_matching_model_microcode(unsigned long start,
334 331
335 if (leftover) { 332 if (leftover) {
336 state = UCODE_ERROR; 333 state = UCODE_ERROR;
337 goto out; 334 return state;
338 } 335 }
339 336
340 if (!num_saved) { 337 if (!num_saved) {
341 state = UCODE_NFOUND; 338 state = UCODE_NFOUND;
342 goto out; 339 return state;
343 } 340 }
344 341
345 for (i = 0; i < num_saved; i++) 342 for (i = 0; i < num_saved; i++)
346 mc_ptrs[i] = (unsigned long)mc_saved_tmp[i] - start; 343 mc_ptrs[i] = (unsigned long)mc_saved_tmp[i] - start;
347 344
348 mcs->num_saved = num_saved; 345 mcs->num_saved = num_saved;
349out: 346
350 return state; 347 return state;
351} 348}
352 349