Skip to contentSkip to conversation

x86, AMD: fix error path in apply_microcode_amd()

PATCH In review Torsten Kaiser 3 participants 3 messages Jul 23, 2013 – Jul 31, 2013 x86

lore
Share & tools
lore
#0 lore raw

PATCH 1/5 x86, AMD: fix error path in apply_microcode_amd()

Return -1 (like Intels apply_microcode) when the loading fails, also do not set the active microcode level on failure.

arch/x86/kernel/microcode_amd.c +5 -4
@@ -220,12 +220,13 @@ int apply_microcode_amd(int cpu)
 		return 0;
 	}
 
-	if (__apply_microcode_amd(mc_amd))
+	if (__apply_microcode_amd(mc_amd)) {
 		pr_err("CPU%d: update failed for patch_level=0x%08x\n",
 			cpu, mc_amd->hdr.patch_id);
-	else
-		pr_info("CPU%d: new patch_level=0x%08x\n", cpu,
-			mc_amd->hdr.patch_id);
+		return -1;
+	}
+	pr_info("CPU%d: new patch_level=0x%08x\n", cpu,
+		mc_amd->hdr.patch_id);
 
 	uci->cpu_sig.rev = mc_amd->hdr.patch_id;
 	c->microcode = mc_amd->hdr.patch_id;
maintainer Acked-by on v1 1/5
#1 lore raw
Quoted 4 lines · Torsten Kaiser

Return -1 (like Intels apply_microcode) when the loading fails, also do not set the active microcode level on failure.

@hpa: this is a fix for a76096a6571d5 which went in during this merge window so queue it for tip-urgent please.

Signature · 5 lines
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--
#2 lore raw

[tip:x86/urgent] x86, amd, microcode: Fix error path in apply_microcode_amd()

In reply to Torsten Kaiser
x86, amd, microcode: Fix error path in apply_microcode_amd()
Commit-ID:  d982057f631df04f8d78321084a1a71ca51f3364
Gitweb:     http://git.kernel.org/tip/d982057f631df04f8d78321084a1a71ca51f3364
Author:     Torsten Kaiser <[email protected]>
AuthorDate: Tue, 23 Jul 2013 22:58:23 +0200
Committer:  H. Peter Anvin <[email protected]>
CommitDate: Wed, 31 Jul 2013 08:37:14 -0700

x86, amd, microcode: Fix error path in apply_microcode_amd()

Return -1 (like Intels apply_microcode) when the loading fails, also do not set the active microcode level on failure.

---
 arch/x86/kernel/microcode_amd.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
arch/x86/kernel/microcode_amd.c +5 -4
index 47ebb1d..7a0adb7 100644
@@ -220,12 +220,13 @@ int apply_microcode_amd(int cpu)
 		return 0;
 	}
 
-	if (__apply_microcode_amd(mc_amd))
+	if (__apply_microcode_amd(mc_amd)) {
 		pr_err("CPU%d: update failed for patch_level=0x%08x\n",
 			cpu, mc_amd->hdr.patch_id);
-	else
-		pr_info("CPU%d: new patch_level=0x%08x\n", cpu,
-			mc_amd->hdr.patch_id);
+		return -1;
+	}
+	pr_info("CPU%d: new patch_level=0x%08x\n", cpu,
+		mc_amd->hdr.patch_id);
 
 	uci->cpu_sig.rev = mc_amd->hdr.patch_id;
 	c->microcode = mc_amd->hdr.patch_id;