Skip to contentSkip to conversation

x86, microcode: Don't lose error returns in save_microcode_in_initrd()

PATCH In review Torsten Kaiser 2 participants 2 messages Jul 23, 2013 – Jul 24, 2013 x86

lore
Share & tools
lore
#0 lore raw

PATCH 2/5 x86, microcode: Don't lose error returns in save_microcode_in_initrd()

Don't lose the error return.
This was lost when early amd microcode loading was added in 757885e94a22bcc82beb9b1445c95218cb20ceab

arch/x86/kernel/microcode_core_early.c +2 -2
@@ -127,11 +127,11 @@ int __init save_microcode_in_initrd(void
 	switch (c->x86_vendor) {
 	case X86_VENDOR_INTEL:
 		if (c->x86 >= 6)
-			save_microcode_in_initrd_intel();
+			return save_microcode_in_initrd_intel();
 		break;
 	case X86_VENDOR_AMD:
 		if (c->x86 >= 0x10)
-			save_microcode_in_initrd_amd();
+			return save_microcode_in_initrd_amd();
 		break;
 	default:
 		break;
maintainer
#1 lore raw
Quoted 9 lines · Torsten Kaiser

Don't lose the error return.
This was lost when early amd microcode loading was added in 757885e94a22bcc82beb9b1445c95218cb20ceab

arch/x86/kernel/microcode_core_early.c int __init save_microcode_in_initrd(void · line 134

Quoted 10 lines
arch/x86/kernel/microcode_core_early.c +2 -2
@@ -127,11 +127,11 @@ int __init save_microcode_in_initrd(void
 	switch (c->x86_vendor) {
 	case X86_VENDOR_INTEL:
 		if (c->x86 >= 6)
-			save_microcode_in_initrd_intel();
+			return save_microcode_in_initrd_intel();
 		break;
 	case X86_VENDOR_AMD:
 		if (c->x86 >= 0x10)
-			save_microcode_in_initrd_amd();
+			return save_microcode_in_initrd_amd();

This one is incomplete: if we really want to hand up the error code, we need to add a printk to the caller free_initrd_mem() saying that saving of microcode from the initrd failed.

However, save_microcode_in_initrd_intel() already warns about it in the error case.

So, actually, I think the warning should be issued by save_microcode_in_initrd() and this function itself should be made to return void. And save_microcode_in_initrd_intel() can simply return the error code without doing the printk.

Signature · 5 lines
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--