lkml.org 
[lkml]   [2023]   [Jan]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] samples: ftrace: make some global variables static
On Tue, 31 Jan 2023 10:09:25 +0000
Mark Rutland <mark.rutland@arm.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@redhat.com>
>
> With the above taken into account:
>
> Acked-by: Mark Rutland <mark.rutland@arm.com>

Thanks,

-- Steve

\
 
 \ /
  Last update: 2023-03-27 00:03    [W:0.070 / U:0.172 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site