[PATCH 29/49] x86/alternatives: Simplify try_get_text_poke_array()
From: Ingo Molnar
Date: Fri Mar 28 2025 - 09:34:45 EST
There's no need to return a pointer on success - it's always
the same pointer.
Return a bool instead.
Signed-off-by: Ingo Molnar <mingo@xxxxxxxxxx>
---
arch/x86/kernel/alternative.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c
index 202720228c98..12f0fd35773d 100644
--- a/arch/x86/kernel/alternative.c
+++ b/arch/x86/kernel/alternative.c
@@ -2475,15 +2475,14 @@ static struct smp_text_poke_array {
static DEFINE_PER_CPU(atomic_t, int3_refs);
-static __always_inline
-struct smp_text_poke_array *try_get_text_poke_array(void)
+static bool try_get_text_poke_array(void)
{
atomic_t *refs = this_cpu_ptr(&int3_refs);
if (!raw_atomic_inc_not_zero(refs))
- return NULL;
+ return false;
- return &text_poke_array;
+ return true;
}
static __always_inline void put_text_poke_array(void)
@@ -2530,9 +2529,9 @@ noinstr int smp_text_poke_int3_trap_handler(struct pt_regs *regs)
*/
smp_rmb();
- desc = try_get_text_poke_array();
- if (!desc)
+ if (!try_get_text_poke_array())
return 0;
+ desc = &text_poke_array;
WARN_ON_ONCE(desc->vec != text_poke_array.vec);
--
2.45.2