[PATCH 09/22] x86/srso: Simplify exit paths
From: Josh Poimboeuf
Date: Sun Aug 20 2023 - 21:19:47 EST
Send all function exit paths through the pred_cmd check to simplify the
control flow and make it more future-proof.
While at it, rename the 'pred_cmd' label to 'out' to make it clear that
it's the exit.
Signed-off-by: Josh Poimboeuf <jpoimboe@xxxxxxxxxx>
---
arch/x86/kernel/cpu/bugs.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c
index e59e09babf8f..da480c089739 100644
--- a/arch/x86/kernel/cpu/bugs.c
+++ b/arch/x86/kernel/cpu/bugs.c
@@ -2407,7 +2407,7 @@ static void __init srso_select_mitigation(void)
bool has_microcode = boot_cpu_has(X86_FEATURE_IBPB_BRTYPE);
if (!boot_cpu_has_bug(X86_BUG_SRSO) || cpu_mitigations_off())
- goto pred_cmd;
+ goto out;
if (!has_microcode) {
pr_warn("IBPB-extending microcode not applied!\n");
@@ -2419,7 +2419,7 @@ static void __init srso_select_mitigation(void)
*/
if (boot_cpu_data.x86 < 0x19 && !cpu_smt_possible()) {
setup_force_cpu_cap(X86_FEATURE_SRSO_NO);
- return;
+ goto out;
}
}
@@ -2427,13 +2427,13 @@ static void __init srso_select_mitigation(void)
if (has_microcode) {
pr_info("Retbleed IBPB mitigation enabled, using same for SRSO\n");
srso_mitigation = SRSO_MITIGATION_IBPB;
- goto pred_cmd;
+ goto out;
}
}
switch (srso_cmd) {
case SRSO_CMD_OFF:
- goto pred_cmd;
+ goto out;
case SRSO_CMD_MICROCODE:
if (has_microcode) {
@@ -2489,7 +2489,7 @@ static void __init srso_select_mitigation(void)
pr_info("%s%s\n", srso_strings[srso_mitigation], (has_microcode ? "" : ", no microcode"));
-pred_cmd:
+out:
if (boot_cpu_has(X86_FEATURE_SBPB) && srso_mitigation == SRSO_MITIGATION_NONE)
x86_pred_cmd = PRED_CMD_SBPB;
}
--
2.41.0