Skip to content

Commit

Permalink
x86, microcode: Simplify vfree() use
Browse files Browse the repository at this point in the history
vfree() does its own 'NULL' check, so no need for check before
calling it.

In v2, remove the stray newline.

[ Impact: cleanup ]

Signed-off-by: Figo.zhang <[email protected]>
Cc: Dmitry Adamushko <[email protected]>
LKML-Reference: <1244385036.3402.11.camel@myhost>
Signed-off-by: Ingo Molnar <[email protected]>
  • Loading branch information
Figo1802 authored and Ingo Molnar committed Jun 7, 2009
1 parent 871b72d commit aeef50b
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions arch/x86/kernel/microcode_amd.c
Original file line number Diff line number Diff line change
Expand Up @@ -241,10 +241,8 @@ static int install_equiv_cpu_table(const u8 *buf)

static void free_equiv_cpu_table(void)
{
if (equiv_cpu_table) {
vfree(equiv_cpu_table);
equiv_cpu_table = NULL;
}
vfree(equiv_cpu_table);
equiv_cpu_table = NULL;
}

static enum ucode_state
Expand Down Expand Up @@ -279,8 +277,7 @@ generic_load_microcode(int cpu, const u8 *data, size_t size)

mc_header = (struct microcode_header_amd *)mc;
if (get_matching_microcode(cpu, mc, new_rev)) {
if (new_mc)
vfree(new_mc);
vfree(new_mc);
new_rev = mc_header->patch_id;
new_mc = mc;
} else
Expand All @@ -292,8 +289,7 @@ generic_load_microcode(int cpu, const u8 *data, size_t size)

if (new_mc) {
if (!leftover) {
if (uci->mc)
vfree(uci->mc);
vfree(uci->mc);
uci->mc = new_mc;
pr_debug("microcode: CPU%d found a matching microcode "
"update with version 0x%x (current=0x%x)\n",
Expand Down

0 comments on commit aeef50b

Please sign in to comment.