> On 02/05/23, 11:42 PM, "kernel test robot" lkp@intel.com wrote:
kernel/trace/trace_events.c:2424:17: warning: variable 'd_events' set but not used [-Wunused-but-set-variable]
struct dentry *d_events; ^
1 warning generated.
Steve, with-in event_create_dir(), do we have any scenario when file->event_call->class->system doesn't have TRACE_SYSTEM? And need to execute following:
ae63b31e4d0e2e Steven Rostedt 2012-05-03 2437 d_events = parent;
looking for your input if we could remove d_events from event_create_dir().
- Ajay
vim +/d_events +2424 kernel/trace/trace_events.c
ac343da7bc9048 Masami Hiramatsu 2020-09-10 2417 1473e4417c79f1 Steven Rostedt 2009-02-24 2418 static int 7f1d2f8210195c Steven Rostedt (Red Hat 2015-05-05 2419) event_create_dir(struct dentry *parent, struct trace_event_file *file) 1473e4417c79f1 Steven Rostedt 2009-02-24 2420 { 2425bcb9240f8c Steven Rostedt (Red Hat 2015-05-05 2421) struct trace_event_call *call = file->event_call; ae63b31e4d0e2e Steven Rostedt 2012-05-03 2422 struct trace_array *tr = file->tr; 2fe2002efb23a7 Ajay Kaher 2023-05-02 2423 struct eventfs_file *ef_subsystem = NULL; ae63b31e4d0e2e Steven Rostedt 2012-05-03 @2424 struct dentry *d_events; de7b2973903c6c Mathieu Desnoyers 2014-04-08 2425 const char *name; fd99498989f3b3 Steven Rostedt 2009-02-28 2426 int ret; 1473e4417c79f1 Steven Rostedt 2009-02-24 2427 6ecc2d1ca39177 Steven Rostedt 2009-02-27 2428 /* 6ecc2d1ca39177 Steven Rostedt 2009-02-27 2429 * If the trace point header did not define TRACE_SYSTEM 6ecc2d1ca39177 Steven Rostedt 2009-02-27 2430 * then the system would be called "TRACE_SYSTEM". 6ecc2d1ca39177 Steven Rostedt 2009-02-27 2431 */ ae63b31e4d0e2e Steven Rostedt 2012-05-03 2432 if (strcmp(call->class->system, TRACE_SYSTEM) != 0) { 2fe2002efb23a7 Ajay Kaher 2023-05-02 2433 ef_subsystem = event_subsystem_dir(tr, call->class->system, file, parent); 2fe2002efb23a7 Ajay Kaher 2023-05-02 2434 if (!ef_subsystem) ae63b31e4d0e2e Steven Rostedt 2012-05-03 2435 return -ENOMEM; ae63b31e4d0e2e Steven Rostedt 2012-05-03 2436 } else ae63b31e4d0e2e Steven Rostedt 2012-05-03 2437 d_events = parent; 6ecc2d1ca39177 Steven Rostedt 2009-02-27 2438 687fcc4aee4567 Steven Rostedt (Red Hat 2015-05-13 2439) name = trace_event_name(call); 2fe2002efb23a7 Ajay Kaher 2023-05-02 2440 file->ef = eventfs_add_dir(name, ef_subsystem, &tr->eventfs_rwsem); 2fe2002efb23a7 Ajay Kaher 2023-05-02 2441 if (IS_ERR(file->ef)) { 8434dc9340cd2e Steven Rostedt (Red Hat 2015-01-20 2442) pr_warn("Could not create tracefs '%s' directory\n", name); 1473e4417c79f1 Steven Rostedt 2009-02-24 2443 return -1; 1473e4417c79f1 Steven Rostedt 2009-02-24 2444 } 1473e4417c79f1 Steven Rostedt 2009-02-24 2445 9b63776fa3ca96 Steven Rostedt 2012-05-10 2446 if (call->class->reg && !(call->flags & TRACE_EVENT_FL_IGNORE_ENABLE)) 2fe2002efb23a7 Ajay Kaher 2023-05-02 2447 eventfs_add_file("enable", TRACE_MODE_WRITE, file->ef, file, 620a30e97febc8 Oleg Nesterov 2013-07-31 2448 &ftrace_enable_fops); 1473e4417c79f1 Steven Rostedt 2009-02-24 2449