[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20230131103935.4966c46e@gandalf.local.home>
Date: Tue, 31 Jan 2023 10:39:35 -0500
From: Steven Rostedt <rostedt@...dmis.org>
To: Mark Rutland <mark.rutland@....com>
Cc: Tom Rix <trix@...hat.com>, mhiramat@...nel.org,
linux-kernel@...r.kernel.org, linux-trace-kernel@...r.kernel.org
Subject: Re: [PATCH] samples: ftrace: make some global variables static
On Tue, 31 Jan 2023 10:09:25 +0000
Mark Rutland <mark.rutland@....com> wrote:
> On Mon, Jan 30, 2023 at 11:37:08AM -0800, Tom Rix wrote:
> > 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.
>
> > 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.
>
> > Signed-off-by: Tom Rix <trix@...hat.com>
>
> With the above taken into account:
>
> Acked-by: Mark Rutland <mark.rutland@....com>
Thanks,
-- Steve
Powered by blists - more mailing lists