History

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

Li kunyu committed 4 years ago

Commit 3a2bfec1 parent 2decd166 files · +13 −28Browse files

Unified · Split

6 files
  1. arch/arm/kernel/ftrace.c +2 −4
  2. arch/riscv/kernel/ftrace.c +2 −4
  3. arch/s390/kernel/ftrace.c +1 −2
  4. arch/x86/kernel/ftrace.c +2 −4
  5. include/linux/ftrace.h +2 −2
  6. kernel/trace/ftrace.c +4 −12
arch/arm/kernel/ftrace.c+2−4
@@ -79,16 +79,14 @@ static unsigned long __ref adjust_address(struct dyn_ftrace *rec, · 78 unmodified lines
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+2−4
@@ -12,16 +12,14 @@ · 11 unmodified lines
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+1−2
@@ -225,14 +225,13 @@ void arch_ftrace_update_code(int command) · 224 unmodified lines
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+2−4
@@ -37,7 +37,7 @@ · 36 unmodified lines
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) · 3 unmodified lines
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) · 4 unmodified lines
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+2−2
@@ -449,8 +449,8 @@ static inline void stack_tracer_enable(void) { } · 448 unmodified lines
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+4−12
@@ -2704,18 +2704,16 @@ ftrace_nop_initialize(struct module *mod, struct dyn_ftrace *rec) · 2703 unmodified lines
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) · 79 unmodified lines
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) · 3 unmodified lines
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,