diff mbox series

tracing: Fix -Wundef around 'struct event_mod_load'

Message ID 20250120-trace_events-fix-wundef-v1-1-61259cbbaa75@kernel.org (mailing list archive)
State Queued
Commit a925df6f5036013b6592eef28f7ec4a45bf465a9
Headers show
Series tracing: Fix -Wundef around 'struct event_mod_load' | expand

Commit Message

Nathan Chancellor Jan. 20, 2025, 12:29 p.m. UTC
When CONFIG_MODULES is disabled, clang warns:

  kernel/trace/trace_events.c:872:5: warning: 'CONFIG_MODULES' is not defined, evaluates to 0 [-Wundef]
    872 | #if CONFIG_MODULES
        |     ^

Use '#ifdef' to resolve the warning.

Fixes: b355247df104 ("tracing: Cache ":mod:" events for modules not loaded yet")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202501190121.E2CIJuUj-lkp@intel.com/
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
 kernel/trace/trace_events.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


---
base-commit: 9f3ccaeedbe0088f1b89474bcf4187c49cfe8de2
change-id: 20250120-trace_events-fix-wundef-7a1153105f5f

Best regards,

Comments

Steven Rostedt Jan. 20, 2025, 5:36 p.m. UTC | #1
On Mon, 20 Jan 2025 05:29:24 -0700
Nathan Chancellor <nathan@kernel.org> wrote:

> When CONFIG_MODULES is disabled, clang warns:
> 
>   kernel/trace/trace_events.c:872:5: warning: 'CONFIG_MODULES' is not defined, evaluates to 0 [-Wundef]
>     872 | #if CONFIG_MODULES
>         |     ^
> 
> Use '#ifdef' to resolve the warning.
> 
> Fixes: b355247df104 ("tracing: Cache ":mod:" events for modules not loaded yet")
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202501190121.E2CIJuUj-lkp@intel.com/
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>

Yes yes, I had this fixed locally but never tested nor pushed it out. :-p

Thanks,

-- Steve

> ---
>  kernel/trace/trace_events.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
> index ab04994e4510..de934332ba36 100644
> --- a/kernel/trace/trace_events.c
> +++ b/kernel/trace/trace_events.c
> @@ -869,7 +869,7 @@ static int ftrace_event_enable_disable(struct trace_event_file *file,
>  	return __ftrace_event_enable_disable(file, enable, 0);
>  }
>  
> -#if CONFIG_MODULES
> +#ifdef CONFIG_MODULES
>  struct event_mod_load {
>  	struct list_head	list;
>  	char			*module;
> 
> ---
> base-commit: 9f3ccaeedbe0088f1b89474bcf4187c49cfe8de2
> change-id: 20250120-trace_events-fix-wundef-7a1153105f5f
> 
> Best regards,
diff mbox series

Patch

diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
index ab04994e4510..de934332ba36 100644
--- a/kernel/trace/trace_events.c
+++ b/kernel/trace/trace_events.c
@@ -869,7 +869,7 @@  static int ftrace_event_enable_disable(struct trace_event_file *file,
 	return __ftrace_event_enable_disable(file, enable, 0);
 }
 
-#if CONFIG_MODULES
+#ifdef CONFIG_MODULES
 struct event_mod_load {
 	struct list_head	list;
 	char			*module;