tracing/osnoise: Fix sparse warning in function start_kthread
Subsystems (2)
PATCH 1/1 tracing/osnoise: Fix sparse warning in function start_kthread
Change main to main_func to fix following sparse warning:
kernel/trace/trace_osnoise.c: In function ‘start_kthread’:kernel/trace/trace_osnoise.c:1674:8: warning: ‘main’ is usually a function [-Wmain]
void *main = osnoise_main;
^~~~Signed-off-by Wang ShaoBo <[email protected]>
--- kernel/trace/trace_osnoise.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
kernel/trace/trace_osnoise.c +3 -3
@@ -1691,17 +1691,17 @@ static void stop_per_cpu_kthreads(void)static int start_kthread (unsigned int cpu) {struct task_struct *kthread; -void *main = osnoise_main; +void *main_func = osnoise_main;char comm[24 ];if (timerlat_enabled ()) {snprintf (comm,24 ,"timerlat/%d" , cpu); - main = timerlat_main; + main_func = timerlat_main; }else {snprintf (comm,24 ,"osnoise/%d" , cpu); } - kthread =kthread_create_on_cpu (main,NULL , cpu, comm); + kthread =kthread_create_on_cpu (main_func,NULL , cpu, comm);if (IS_ERR (kthread)) {pr_err (BANNER "could not start sampling thread\n" );
Signature · 1 line
2.25.1
Quoted 6 lines · Wang ShaoBo
Change main to
main_functo fix following sparse warning:
kernel/trace/trace_osnoise.c: In function ‘start_kthread’:kernel/trace/trace_osnoise.c:1674:8: warning: ‘main’ is usually a function [-Wmain]void *main = osnoise_main; ^~~~
NAK!
This was already discussed... many times. The problem is not in the usage of main as a variable name but in the tool that you are using. Try to fix your tool.
E.g., https://lore.kernel.org/lkml/[email protected]/
-- Daniel