Skip to content

Commit 3a2bfec

Browse files
likunyurrostedt
authored andcommitted
ftrace: Remove return value of ftrace_arch_modify_*()
All instances of the function ftrace_arch_modify_prepare() and ftrace_arch_modify_post_process() return zero. There's no point in checking their return value. Just have them be void functions. Link: https://lkml.kernel.org/r/20220518023639.4065-1-kunyu@nfschina.com Signed-off-by: Li kunyu <kunyu@nfschina.com> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
1 parent 2decd16 commit 3a2bfec

6 files changed

Lines changed: 13 additions & 28 deletions

File tree

arch/arm/kernel/ftrace.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,16 +79,14 @@ static unsigned long __ref adjust_address(struct dyn_ftrace *rec,
7979
return (unsigned long)&ftrace_regs_caller_from_init;
8080
}
8181

82-
int ftrace_arch_code_modify_prepare(void)
82+
void ftrace_arch_code_modify_prepare(void)
8383
{
84-
return 0;
8584
}
8685

87-
int ftrace_arch_code_modify_post_process(void)
86+
void ftrace_arch_code_modify_post_process(void)
8887
{
8988
/* Make sure any TLB misses during machine stop are cleared. */
9089
flush_tlb_all();
91-
return 0;
9290
}
9391

9492
static unsigned long ftrace_call_replace(unsigned long pc, unsigned long addr,

arch/riscv/kernel/ftrace.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,14 @@
1212
#include <asm/patch.h>
1313

1414
#ifdef CONFIG_DYNAMIC_FTRACE
15-
int ftrace_arch_code_modify_prepare(void) __acquires(&text_mutex)
15+
void ftrace_arch_code_modify_prepare(void) __acquires(&text_mutex)
1616
{
1717
mutex_lock(&text_mutex);
18-
return 0;
1918
}
2019

21-
int ftrace_arch_code_modify_post_process(void) __releases(&text_mutex)
20+
void ftrace_arch_code_modify_post_process(void) __releases(&text_mutex)
2221
{
2322
mutex_unlock(&text_mutex);
24-
return 0;
2523
}
2624

2725
static int ftrace_check_current_call(unsigned long hook_pos,

arch/s390/kernel/ftrace.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,14 +225,13 @@ void arch_ftrace_update_code(int command)
225225
ftrace_modify_all_code(command);
226226
}
227227

228-
int ftrace_arch_code_modify_post_process(void)
228+
void ftrace_arch_code_modify_post_process(void)
229229
{
230230
/*
231231
* Flush any pre-fetched instructions on all
232232
* CPUs to make the new code visible.
233233
*/
234234
text_poke_sync_lock();
235-
return 0;
236235
}
237236

238237
#ifdef CONFIG_MODULES

arch/x86/kernel/ftrace.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737

3838
static int ftrace_poke_late = 0;
3939

40-
int ftrace_arch_code_modify_prepare(void)
40+
void ftrace_arch_code_modify_prepare(void)
4141
__acquires(&text_mutex)
4242
{
4343
/*
@@ -47,10 +47,9 @@ int ftrace_arch_code_modify_prepare(void)
4747
*/
4848
mutex_lock(&text_mutex);
4949
ftrace_poke_late = 1;
50-
return 0;
5150
}
5251

53-
int ftrace_arch_code_modify_post_process(void)
52+
void ftrace_arch_code_modify_post_process(void)
5453
__releases(&text_mutex)
5554
{
5655
/*
@@ -61,7 +60,6 @@ int ftrace_arch_code_modify_post_process(void)
6160
text_poke_finish();
6261
ftrace_poke_late = 0;
6362
mutex_unlock(&text_mutex);
64-
return 0;
6563
}
6664

6765
static const char *ftrace_nop_replace(void)

include/linux/ftrace.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -449,8 +449,8 @@ static inline void stack_tracer_enable(void) { }
449449

450450
#ifdef CONFIG_DYNAMIC_FTRACE
451451

452-
int ftrace_arch_code_modify_prepare(void);
453-
int ftrace_arch_code_modify_post_process(void);
452+
void ftrace_arch_code_modify_prepare(void);
453+
void ftrace_arch_code_modify_post_process(void);
454454

455455
enum ftrace_bug_type {
456456
FTRACE_BUG_UNKNOWN,

kernel/trace/ftrace.c

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2704,18 +2704,16 @@ ftrace_nop_initialize(struct module *mod, struct dyn_ftrace *rec)
27042704
* archs can override this function if they must do something
27052705
* before the modifying code is performed.
27062706
*/
2707-
int __weak ftrace_arch_code_modify_prepare(void)
2707+
void __weak ftrace_arch_code_modify_prepare(void)
27082708
{
2709-
return 0;
27102709
}
27112710

27122711
/*
27132712
* archs can override this function if they must do something
27142713
* after the modifying code is performed.
27152714
*/
2716-
int __weak ftrace_arch_code_modify_post_process(void)
2715+
void __weak ftrace_arch_code_modify_post_process(void)
27172716
{
2718-
return 0;
27192717
}
27202718

27212719
void ftrace_modify_all_code(int command)
@@ -2801,12 +2799,7 @@ void __weak arch_ftrace_update_code(int command)
28012799

28022800
static void ftrace_run_update_code(int command)
28032801
{
2804-
int ret;
2805-
2806-
ret = ftrace_arch_code_modify_prepare();
2807-
FTRACE_WARN_ON(ret);
2808-
if (ret)
2809-
return;
2802+
ftrace_arch_code_modify_prepare();
28102803

28112804
/*
28122805
* By default we use stop_machine() to modify the code.
@@ -2816,8 +2809,7 @@ static void ftrace_run_update_code(int command)
28162809
*/
28172810
arch_ftrace_update_code(command);
28182811

2819-
ret = ftrace_arch_code_modify_post_process();
2820-
FTRACE_WARN_ON(ret);
2812+
ftrace_arch_code_modify_post_process();
28212813
}
28222814

28232815
static void ftrace_run_modify_code(struct ftrace_ops *ops, int command,

0 commit comments

Comments
 (0)