Re: [PATCH] trace: Fix some checker warnings

From: Google
Date: Mon Dec 05 2022 - 04:08:40 EST


On Mon, 05 Dec 2022 08:28:35 +0000
David Howells <dhowells@xxxxxxxxxx> wrote:

> Masami Hiramatsu (Google) <mhiramat@xxxxxxxxxx> wrote:
>
> > > +#if defined(CONFIG_TRACER_MAX_TRACE) || defined(CONFIG_HWLAT_TRACER)
> > > static const struct file_operations tracing_max_lat_fops;
> > > +#endif
> >
> > Oops, I missed this part. Why did you introduced this #ifdefs?
>
> Because:
>
> #if defined(CONFIG_TRACER_MAX_TRACE) || defined(CONFIG_HWLAT_TRACER)
> static const struct file_operations tracing_max_lat_fops = {
>
> in the same file. You get something like an unused symbol warning otherwise
> if neither config option is defined.

Yeah, I got it. Without the above change, the compile error will be gone,
but this means that the declaration becomes a definition. (it uses an empty
data structure)

Could you remove that part from your printf checker macro, and
apply the below patch?
Since the printf macros are a kind of improvement but this part is an
actual bug, need to be fixed on stable kernel too.