Skip to content

Commit aeef50b

Browse files
Figo1802Ingo Molnar
authored andcommitted
x86, microcode: Simplify vfree() use
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 <figo1802@gmail.com> Cc: Dmitry Adamushko <dmitry.adamushko@gmail.com> LKML-Reference: <1244385036.3402.11.camel@myhost> Signed-off-by: Ingo Molnar <mingo@elte.hu>
1 parent 871b72d commit aeef50b

1 file changed

Lines changed: 4 additions & 8 deletions

File tree

‎arch/x86/kernel/microcode_amd.c‎

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -241,10 +241,8 @@ static int install_equiv_cpu_table(const u8 *buf)
241241

242242
static void free_equiv_cpu_table(void)
243243
{
244-
if (equiv_cpu_table) {
245-
vfree(equiv_cpu_table);
246-
equiv_cpu_table = NULL;
247-
}
244+
vfree(equiv_cpu_table);
245+
equiv_cpu_table = NULL;
248246
}
249247

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

280278
mc_header = (struct microcode_header_amd *)mc;
281279
if (get_matching_microcode(cpu, mc, new_rev)) {
282-
if (new_mc)
283-
vfree(new_mc);
280+
vfree(new_mc);
284281
new_rev = mc_header->patch_id;
285282
new_mc = mc;
286283
} else
@@ -292,8 +289,7 @@ generic_load_microcode(int cpu, const u8 *data, size_t size)
292289

293290
if (new_mc) {
294291
if (!leftover) {
295-
if (uci->mc)
296-
vfree(uci->mc);
292+
vfree(uci->mc);
297293
uci->mc = new_mc;
298294
pr_debug("microcode: CPU%d found a matching microcode "
299295
"update with version 0x%x (current=0x%x)\n",

0 commit comments

Comments
 (0)