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
79 return (unsigned long)&ftrace_regs_caller_from_init;79 return (unsigned long)&ftrace_regs_caller_from_init;
80}80}
81 81
82int ftrace_arch_code_modify_prepare(void)82void ftrace_arch_code_modify_prepare(void)
83{83{
84 return 0;
85}84}
86 85
87int ftrace_arch_code_modify_post_process(void)86void ftrace_arch_code_modify_post_process(void)
88{87{
89 /* Make sure any TLB misses during machine stop are cleared. */88 /* Make sure any TLB misses during machine stop are cleared. */
90 flush_tlb_all();89 flush_tlb_all();
91 return 0;
92}90}
93 91
94static unsigned long ftrace_call_replace(unsigned long pc, unsigned long addr,92static 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
12#include <asm/patch.h>12#include <asm/patch.h>
13 13
14#ifdef CONFIG_DYNAMIC_FTRACE14#ifdef CONFIG_DYNAMIC_FTRACE
15int ftrace_arch_code_modify_prepare(void) __acquires(&text_mutex)15void ftrace_arch_code_modify_prepare(void) __acquires(&text_mutex)
16{16{
17 mutex_lock(&text_mutex);17 mutex_lock(&text_mutex);
18 return 0;
19}18}
20 19
21int ftrace_arch_code_modify_post_process(void) __releases(&text_mutex)20void ftrace_arch_code_modify_post_process(void) __releases(&text_mutex)
22{21{
23 mutex_unlock(&text_mutex);22 mutex_unlock(&text_mutex);
24 return 0;
25}23}
26 24
27static int ftrace_check_current_call(unsigned long hook_pos,25static 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
225 ftrace_modify_all_code(command);225 ftrace_modify_all_code(command);
226}226}
227 227
228int ftrace_arch_code_modify_post_process(void)228void ftrace_arch_code_modify_post_process(void)
229{229{
230 /*230 /*
231 * Flush any pre-fetched instructions on all231 * Flush any pre-fetched instructions on all
232 * CPUs to make the new code visible.232 * CPUs to make the new code visible.
233 */233 */
234 text_poke_sync_lock();234 text_poke_sync_lock();
235 return 0;
236}235}
237 236
238#ifdef CONFIG_MODULES237#ifdef CONFIG_MODULES
arch/x86/kernel/ftrace.c+2−4
@@ -37,7 +37,7 @@ · 36 unmodified lines
37 37
38static int ftrace_poke_late = 0;38static int ftrace_poke_late = 0;
39 39
40int ftrace_arch_code_modify_prepare(void)40void ftrace_arch_code_modify_prepare(void)
41 __acquires(&text_mutex)41 __acquires(&text_mutex)
42{42{
43 /*43 /*
@@ -47,10 +47,9 @@ int ftrace_arch_code_modify_prepare(void) · 3 unmodified lines
47 */47 */
48 mutex_lock(&text_mutex);48 mutex_lock(&text_mutex);
49 ftrace_poke_late = 1;49 ftrace_poke_late = 1;
50 return 0;
51}50}
52 51
53int ftrace_arch_code_modify_post_process(void)52void ftrace_arch_code_modify_post_process(void)
54 __releases(&text_mutex)53 __releases(&text_mutex)
55{54{
56 /*55 /*
@@ -61,7 +60,6 @@ int ftrace_arch_code_modify_post_process(void) · 4 unmodified lines
61 text_poke_finish();60 text_poke_finish();
62 ftrace_poke_late = 0;61 ftrace_poke_late = 0;
63 mutex_unlock(&text_mutex);62 mutex_unlock(&text_mutex);
64 return 0;
65}63}
66 64
67static const char *ftrace_nop_replace(void)65static 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
449 449
450#ifdef CONFIG_DYNAMIC_FTRACE450#ifdef CONFIG_DYNAMIC_FTRACE
451 451
452int ftrace_arch_code_modify_prepare(void);452void ftrace_arch_code_modify_prepare(void);
453int ftrace_arch_code_modify_post_process(void);453void ftrace_arch_code_modify_post_process(void);
454 454
455enum ftrace_bug_type {455enum ftrace_bug_type {
456 FTRACE_BUG_UNKNOWN,456 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
2704 * archs can override this function if they must do something2704 * archs can override this function if they must do something
2705 * before the modifying code is performed.2705 * before the modifying code is performed.
2706 */2706 */
2707int __weak ftrace_arch_code_modify_prepare(void)2707void __weak ftrace_arch_code_modify_prepare(void)
2708{2708{
2709 return 0;
2710}2709}
2711 2710
2712/*2711/*
2713 * archs can override this function if they must do something2712 * archs can override this function if they must do something
2714 * after the modifying code is performed.2713 * after the modifying code is performed.
2715 */2714 */
2716int __weak ftrace_arch_code_modify_post_process(void)2715void __weak ftrace_arch_code_modify_post_process(void)
2717{2716{
2718 return 0;
2719}2717}
2720 2718
2721void ftrace_modify_all_code(int command)2719void ftrace_modify_all_code(int command)
@@ -2801,12 +2799,7 @@ void __weak arch_ftrace_update_code(int command) · 79 unmodified lines
2801 2799
2802static void ftrace_run_update_code(int command)2800static void ftrace_run_update_code(int command)
2803{2801{
2804 int ret;2802 ftrace_arch_code_modify_prepare();
2805
2806 ret = ftrace_arch_code_modify_prepare();
2807 FTRACE_WARN_ON(ret);
2808 if (ret)
2809 return;
2810 2803
2811 /*2804 /*
2812 * By default we use stop_machine() to modify the code.2805 * 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
2816 */2809 */
2817 arch_ftrace_update_code(command);2810 arch_ftrace_update_code(command);
2818 2811
2819 ret = ftrace_arch_code_modify_post_process();2812 ftrace_arch_code_modify_post_process();
2820 FTRACE_WARN_ON(ret);
2821}2813}
2822 2814
2823static void ftrace_run_modify_code(struct ftrace_ops *ops, int command,2815static void ftrace_run_modify_code(struct ftrace_ops *ops, int command,