[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20241018155151.702350-2-nik.borisov@suse.com>
Date: Fri, 18 Oct 2024 18:51:49 +0300
From: Nikolay Borisov <nik.borisov@...e.com>
To: bp@...en8.de
Cc: x86@...nel.org,
linux-kernel@...r.kernel.org,
Nikolay Borisov <nik.borisov@...e.com>
Subject: [PATCH 1/3] x86/microcode/AMD: Return bool from find_blobs_in_containers()
Instead of open-coding the check for size/data move it inside the
function and make it return a boolean indicating whether data was found
or not. No functional changes.
Signed-off-by: Nikolay Borisov <nik.borisov@...e.com>
---
arch/x86/kernel/cpu/microcode/amd.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/arch/x86/kernel/cpu/microcode/amd.c b/arch/x86/kernel/cpu/microcode/amd.c
index f63b051f25a0..9986cb85c951 100644
--- a/arch/x86/kernel/cpu/microcode/amd.c
+++ b/arch/x86/kernel/cpu/microcode/amd.c
@@ -554,7 +554,7 @@ static bool get_builtin_microcode(struct cpio_data *cp)
return false;
}
-static void __init find_blobs_in_containers(struct cpio_data *ret)
+static bool __init find_blobs_in_containers(struct cpio_data *ret)
{
struct cpio_data cp;
@@ -562,6 +562,7 @@ static void __init find_blobs_in_containers(struct cpio_data *ret)
cp = find_microcode_in_initrd(ucode_path);
*ret = cp;
+ return cp.data && cp.size;
}
void __init load_ucode_amd_bsp(struct early_load_data *ed, unsigned int cpuid_1_eax)
@@ -576,8 +577,7 @@ void __init load_ucode_amd_bsp(struct early_load_data *ed, unsigned int cpuid_1_
/* Needed in load_microcode_amd() */
ucode_cpu_info[0].cpu_sig.sig = cpuid_1_eax;
- find_blobs_in_containers(&cp);
- if (!(cp.data && cp.size))
+ if (!find_blobs_in_containers(&cp))
return;
if (early_apply_microcode(ed->old_rev, cp.data, cp.size))
@@ -597,8 +597,7 @@ static int __init save_microcode_in_initrd(void)
if (dis_ucode_ldr || c->x86_vendor != X86_VENDOR_AMD || c->x86 < 0x10)
return 0;
- find_blobs_in_containers(&cp);
- if (!(cp.data && cp.size))
+ if (!find_blobs_in_containers(&cp))
return -EINVAL;
scan_containers(cp.data, cp.size, &desc);
--
2.34.1
Powered by blists - more mailing lists