aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/cpu/microcode/intel.c
diff options
context:
space:
mode:
authorBorislav Petkov <bp@suse.de>2016-10-25 05:55:13 -0400
committerIngo Molnar <mingo@kernel.org>2016-10-25 06:28:57 -0400
commitf61337d9841210329c177a20061f49fafff3ff76 (patch)
treea304de3a3c390cacd3d274d4fcae123b30adb3ed /arch/x86/kernel/cpu/microcode/intel.c
parent5879a267520898d595e9cbcae0aad4739c822146 (diff)
x86/microcode/intel: Simplify generic_load_microcode()
Make it return the ucode_state directly instead of assigning to a state variable and jumping to an out: label. No functionality change. Signed-off-by: Borislav Petkov <bp@suse.de> Cc: Andy Lutomirski <luto@kernel.org> Cc: Borislav Petkov <bp@alien8.de> Cc: Brian Gerst <brgerst@gmail.com> Cc: Denys Vlasenko <dvlasenk@redhat.com> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Josh Poimboeuf <jpoimboe@redhat.com> 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/20161025095522.11964-4-bp@alien8.de Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch/x86/kernel/cpu/microcode/intel.c')
-rw-r--r--arch/x86/kernel/cpu/microcode/intel.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/arch/x86/kernel/cpu/microcode/intel.c b/arch/x86/kernel/cpu/microcode/intel.c
index cdc0deab00c9..b84288e08098 100644
--- a/arch/x86/kernel/cpu/microcode/intel.c
+++ b/arch/x86/kernel/cpu/microcode/intel.c
@@ -962,7 +962,6 @@ static enum ucode_state generic_load_microcode(int cpu, void *data, size_t size,
962 u8 *ucode_ptr = data, *new_mc = NULL, *mc = NULL; 962 u8 *ucode_ptr = data, *new_mc = NULL, *mc = NULL;
963 int new_rev = uci->cpu_sig.rev; 963 int new_rev = uci->cpu_sig.rev;
964 unsigned int leftover = size; 964 unsigned int leftover = size;
965 enum ucode_state state = UCODE_OK;
966 unsigned int curr_mc_size = 0; 965 unsigned int curr_mc_size = 0;
967 unsigned int csig, cpf; 966 unsigned int csig, cpf;
968 967
@@ -1015,14 +1014,11 @@ static enum ucode_state generic_load_microcode(int cpu, void *data, size_t size,
1015 1014
1016 if (leftover) { 1015 if (leftover) {
1017 vfree(new_mc); 1016 vfree(new_mc);
1018 state = UCODE_ERROR; 1017 return UCODE_ERROR;
1019 goto out;
1020 } 1018 }
1021 1019
1022 if (!new_mc) { 1020 if (!new_mc)
1023 state = UCODE_NFOUND; 1021 return UCODE_NFOUND;
1024 goto out;
1025 }
1026 1022
1027 vfree(uci->mc); 1023 vfree(uci->mc);
1028 uci->mc = (struct microcode_intel *)new_mc; 1024 uci->mc = (struct microcode_intel *)new_mc;
@@ -1036,8 +1032,8 @@ static enum ucode_state generic_load_microcode(int cpu, void *data, size_t size,
1036 1032
1037 pr_debug("CPU%d found a matching microcode update with version 0x%x (current=0x%x)\n", 1033 pr_debug("CPU%d found a matching microcode update with version 0x%x (current=0x%x)\n",
1038 cpu, new_rev, uci->cpu_sig.rev); 1034 cpu, new_rev, uci->cpu_sig.rev);
1039out: 1035
1040 return state; 1036 return UCODE_OK;
1041} 1037}
1042 1038
1043static int get_ucode_fw(void *to, const void *from, size_t n) 1039static int get_ucode_fw(void *to, const void *from, size_t n)