diff options
author | Borislav Petkov <bp@suse.de> | 2015-05-17 06:55:00 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2015-05-18 03:32:36 -0400 |
commit | 9e5aed83bbd95ca2dee732f56a7a278350cef807 (patch) | |
tree | 5b3ccd3ba6ee378892e5286639d7924cd783fed9 | |
parent | 6b2d469f5b5dd1d39548f2e79557b9b5ffe00eb1 (diff) |
x86/microcode/intel: Simplify get_matching_sig()
Unclutter function, make it a bit more readable, drop local
variables.
No functionality change.
Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Quentin Casasnovas <quentin.casasnovas@oracle.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/1431860101-14847-4-git-send-email-bp@alien8.de
Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r-- | arch/x86/kernel/cpu/microcode/intel_lib.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/arch/x86/kernel/cpu/microcode/intel_lib.c b/arch/x86/kernel/cpu/microcode/intel_lib.c index 1ffe507931af..def9c935f3f9 100644 --- a/arch/x86/kernel/cpu/microcode/intel_lib.c +++ b/arch/x86/kernel/cpu/microcode/intel_lib.c | |||
@@ -133,24 +133,22 @@ EXPORT_SYMBOL_GPL(microcode_sanity_check); | |||
133 | */ | 133 | */ |
134 | int get_matching_sig(unsigned int csig, int cpf, void *mc) | 134 | int get_matching_sig(unsigned int csig, int cpf, void *mc) |
135 | { | 135 | { |
136 | struct microcode_header_intel *mc_header = mc; | 136 | struct microcode_header_intel *mc_hdr = mc; |
137 | struct extended_sigtable *ext_header; | 137 | struct extended_sigtable *ext_hdr; |
138 | unsigned long total_size = get_totalsize(mc_header); | ||
139 | int ext_sigcount, i; | ||
140 | struct extended_signature *ext_sig; | 138 | struct extended_signature *ext_sig; |
139 | int i; | ||
141 | 140 | ||
142 | if (cpu_signatures_match(csig, cpf, mc_header->sig, mc_header->pf)) | 141 | if (cpu_signatures_match(csig, cpf, mc_hdr->sig, mc_hdr->pf)) |
143 | return 1; | 142 | return 1; |
144 | 143 | ||
145 | /* Look for ext. headers: */ | 144 | /* Look for ext. headers: */ |
146 | if (total_size <= get_datasize(mc_header) + MC_HEADER_SIZE) | 145 | if (get_totalsize(mc_hdr) <= get_datasize(mc_hdr) + MC_HEADER_SIZE) |
147 | return 0; | 146 | return 0; |
148 | 147 | ||
149 | ext_header = mc + get_datasize(mc_header) + MC_HEADER_SIZE; | 148 | ext_hdr = mc + get_datasize(mc_hdr) + MC_HEADER_SIZE; |
150 | ext_sigcount = ext_header->count; | 149 | ext_sig = (void *)ext_hdr + EXT_HEADER_SIZE; |
151 | ext_sig = (void *)ext_header + EXT_HEADER_SIZE; | ||
152 | 150 | ||
153 | for (i = 0; i < ext_sigcount; i++) { | 151 | for (i = 0; i < ext_hdr->count; i++) { |
154 | if (cpu_signatures_match(csig, cpf, ext_sig->sig, ext_sig->pf)) | 152 | if (cpu_signatures_match(csig, cpf, ext_sig->sig, ext_sig->pf)) |
155 | return 1; | 153 | return 1; |
156 | ext_sig++; | 154 | ext_sig++; |