tracing: Rename event_trigger_alloc() to trigger_data_alloc()
[ Upstream commit f2947c4b7d0f235621c5daf78aecfbd6e22c05e5 ]
The function event_trigger_alloc() creates an event_trigger_data
descriptor and states that it needs to be freed via event_trigger_free().
This is incorrect, it needs to be freed by trigger_data_free() as
event_trigger_free() adds ref counting.
Rename event_trigger_alloc() to trigger_data_alloc() and state that it
needs to be freed via trigger_data_free(). This naming convention
was introducing bugs.
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Tom Zanussi <zanussi@kernel.org>
Link: https://lore.kernel.org/20250507145455.776436410@goodmis.org
Fixes: 86599dbe2c
("tracing: Add helper functions to simplify event_command.parse() callback handling")
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
3f7724fcc1
commit
ae015964d7
@@ -1643,6 +1643,9 @@ extern int event_enable_register_trigger(char *glob,
|
||||
extern void event_enable_unregister_trigger(char *glob,
|
||||
struct event_trigger_data *test,
|
||||
struct trace_event_file *file);
|
||||
extern struct event_trigger_data *
|
||||
trigger_data_alloc(struct event_command *cmd_ops, char *cmd, char *param,
|
||||
void *private_data);
|
||||
extern void trigger_data_free(struct event_trigger_data *data);
|
||||
extern int event_trigger_init(struct event_trigger_data *data);
|
||||
extern int trace_event_trigger_enable_disable(struct trace_event_file *file,
|
||||
@@ -1669,11 +1672,6 @@ extern bool event_trigger_check_remove(const char *glob);
|
||||
extern bool event_trigger_empty_param(const char *param);
|
||||
extern int event_trigger_separate_filter(char *param_and_filter, char **param,
|
||||
char **filter, bool param_required);
|
||||
extern struct event_trigger_data *
|
||||
event_trigger_alloc(struct event_command *cmd_ops,
|
||||
char *cmd,
|
||||
char *param,
|
||||
void *private_data);
|
||||
extern int event_trigger_parse_num(char *trigger,
|
||||
struct event_trigger_data *trigger_data);
|
||||
extern int event_trigger_set_filter(struct event_command *cmd_ops,
|
||||
|
@@ -6806,7 +6806,7 @@ static int event_hist_trigger_parse(struct event_command *cmd_ops,
|
||||
return PTR_ERR(hist_data);
|
||||
}
|
||||
|
||||
trigger_data = event_trigger_alloc(cmd_ops, cmd, param, hist_data);
|
||||
trigger_data = trigger_data_alloc(cmd_ops, cmd, param, hist_data);
|
||||
if (!trigger_data) {
|
||||
ret = -ENOMEM;
|
||||
goto out_free;
|
||||
|
@@ -809,7 +809,7 @@ out:
|
||||
}
|
||||
|
||||
/**
|
||||
* event_trigger_alloc - allocate and init event_trigger_data for a trigger
|
||||
* trigger_data_alloc - allocate and init event_trigger_data for a trigger
|
||||
* @cmd_ops: The event_command operations for the trigger
|
||||
* @cmd: The cmd string
|
||||
* @param: The param string
|
||||
@@ -820,14 +820,14 @@ out:
|
||||
* trigger_ops to assign to the event_trigger_data. @private_data can
|
||||
* also be passed in and associated with the event_trigger_data.
|
||||
*
|
||||
* Use event_trigger_free() to free an event_trigger_data object.
|
||||
* Use trigger_data_free() to free an event_trigger_data object.
|
||||
*
|
||||
* Return: The trigger_data object success, NULL otherwise
|
||||
*/
|
||||
struct event_trigger_data *event_trigger_alloc(struct event_command *cmd_ops,
|
||||
char *cmd,
|
||||
char *param,
|
||||
void *private_data)
|
||||
struct event_trigger_data *trigger_data_alloc(struct event_command *cmd_ops,
|
||||
char *cmd,
|
||||
char *param,
|
||||
void *private_data)
|
||||
{
|
||||
struct event_trigger_data *trigger_data;
|
||||
struct event_trigger_ops *trigger_ops;
|
||||
@@ -994,7 +994,7 @@ event_trigger_parse(struct event_command *cmd_ops,
|
||||
return ret;
|
||||
|
||||
ret = -ENOMEM;
|
||||
trigger_data = event_trigger_alloc(cmd_ops, cmd, param, file);
|
||||
trigger_data = trigger_data_alloc(cmd_ops, cmd, param, file);
|
||||
if (!trigger_data)
|
||||
goto out;
|
||||
|
||||
@@ -1787,7 +1787,7 @@ int event_enable_trigger_parse(struct event_command *cmd_ops,
|
||||
enable_data->enable = enable;
|
||||
enable_data->file = event_enable_file;
|
||||
|
||||
trigger_data = event_trigger_alloc(cmd_ops, cmd, param, enable_data);
|
||||
trigger_data = trigger_data_alloc(cmd_ops, cmd, param, enable_data);
|
||||
if (!trigger_data) {
|
||||
kfree(enable_data);
|
||||
goto out;
|
||||
|
Reference in New Issue
Block a user