diff options
author | Borislav Petkov <bp@suse.de> | 2015-02-09 11:59:01 -0500 |
---|---|---|
committer | Borislav Petkov <bp@suse.de> | 2015-03-02 14:32:00 -0500 |
commit | c868570e745781736366b83191aae2ccb9de2d1c (patch) | |
tree | fe74bf7d9a8a65145e2b6f3e9fc756ed99be68c7 /arch/x86 | |
parent | a5de5e242b80c085913041e99ab245408083f273 (diff) |
x86/microcode/intel: Sanitize _save_mc()
Shorten local variable names for better readability and flatten loop
indentation levels.
No functionality change.
Signed-off-by: Borislav Petkov <bp@suse.de>
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/kernel/cpu/microcode/intel_early.c | 49 |
1 files changed, 23 insertions, 26 deletions
diff --git a/arch/x86/kernel/cpu/microcode/intel_early.c b/arch/x86/kernel/cpu/microcode/intel_early.c index f1d9a321d424..94ec304b7af3 100644 --- a/arch/x86/kernel/cpu/microcode/intel_early.c +++ b/arch/x86/kernel/cpu/microcode/intel_early.c | |||
@@ -268,39 +268,36 @@ err: | |||
268 | static unsigned int _save_mc(struct microcode_intel **mc_saved, | 268 | static unsigned int _save_mc(struct microcode_intel **mc_saved, |
269 | u8 *ucode_ptr, unsigned int num_saved) | 269 | u8 *ucode_ptr, unsigned int num_saved) |
270 | { | 270 | { |
271 | struct microcode_header_intel *mc_header; | 271 | struct microcode_header_intel *mc_hdr, *mc_saved_hdr; |
272 | unsigned int sig, pf, new_rev; | ||
272 | int found = 0, i; | 273 | int found = 0, i; |
273 | 274 | ||
274 | mc_header = (struct microcode_header_intel *)ucode_ptr; | 275 | mc_hdr = (struct microcode_header_intel *)ucode_ptr; |
275 | 276 | ||
276 | for (i = 0; i < num_saved; i++) { | 277 | for (i = 0; i < num_saved; i++) { |
277 | unsigned int sig, pf; | 278 | mc_saved_hdr = (struct microcode_header_intel *)mc_saved[i]; |
278 | unsigned int new_rev; | 279 | sig = mc_saved_hdr->sig; |
279 | struct microcode_header_intel *mc_saved_header = | 280 | pf = mc_saved_hdr->pf; |
280 | (struct microcode_header_intel *)mc_saved[i]; | 281 | new_rev = mc_hdr->rev; |
281 | sig = mc_saved_header->sig; | 282 | |
282 | pf = mc_saved_header->pf; | 283 | if (!get_matching_sig(sig, pf, ucode_ptr, new_rev)) |
283 | new_rev = mc_header->rev; | 284 | continue; |
284 | 285 | ||
285 | if (get_matching_sig(sig, pf, ucode_ptr, new_rev)) { | 286 | found = 1; |
286 | found = 1; | 287 | |
287 | if (update_match_revision(mc_header, new_rev)) { | 288 | if (!update_match_revision(mc_hdr, new_rev)) |
288 | /* | 289 | continue; |
289 | * Found an older ucode saved before. | ||
290 | * Replace the older one with this newer | ||
291 | * one. | ||
292 | */ | ||
293 | mc_saved[i] = (struct microcode_intel *)ucode_ptr; | ||
294 | break; | ||
295 | } | ||
296 | } | ||
297 | } | ||
298 | 290 | ||
299 | if (i >= num_saved && !found) | ||
300 | /* | 291 | /* |
301 | * This ucode is first time discovered in ucode file. | 292 | * Found an older ucode saved earlier. Replace it with |
302 | * Save it to memory. | 293 | * this newer one. |
303 | */ | 294 | */ |
295 | mc_saved[i] = (struct microcode_intel *)ucode_ptr; | ||
296 | break; | ||
297 | } | ||
298 | |||
299 | /* Newly detected microcode, save it to memory. */ | ||
300 | if (i >= num_saved && !found) | ||
304 | mc_saved[num_saved++] = (struct microcode_intel *)ucode_ptr; | 301 | mc_saved[num_saved++] = (struct microcode_intel *)ucode_ptr; |
305 | 302 | ||
306 | return num_saved; | 303 | return num_saved; |