Thread (4 messages) 4 messages, 3 authors, 2023-01-31

Re: [PATCH] samples: ftrace: make some global variables static

From: Steven Rostedt <rostedt@goodmis.org>
Date: 2023-01-31 15:40:48
Also in: lkml

On Tue, 31 Jan 2023 10:09:25 +0000
Mark Rutland [off-list ref] wrote:
On Mon, Jan 30, 2023 at 11:37:08AM -0800, Tom Rix wrote:
quoted
smatch reports this representative issue
samples/ftrace/ftrace-ops.c:15:14: warning: symbol 'nr_function_calls' was not declared. Should it be static?

The nr_functions_calls and several other global variables are only
used in ftrace-ops.c, so they should be static.  
This makes sense to me.
quoted
Remove the instances of initializing static int to 0.  
I appreciate that static variables get implicitly zero initialized, but
dropping the initialization is inconsistent with the other control variables,
and IMO it's quite confusing, so I'd prefer to keep that for clarity. I note
you've also dropped the initialization of a bool to false, whereas the above
just mentions int.

I'd prefer to keep the initialization, but I'll defre to Steve if he thinks
differently. :)
Yeah, I'm fine with dropping the initialization of even bool (I don't
initialize bool to false either). Everything in the BSS section is always
initialized to zero, and in C, false is the same as zero.
quoted
Signed-off-by: Tom Rix <trix@redhat.com>  
With the above taken into account:

Acked-by: Mark Rutland <mark.rutland@arm.com>
Thanks,

-- Steve
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help