Commit f55c09da authored by Petr Pavlu's avatar Petr Pavlu Committed by Steven Rostedt (Google)
Browse files

tracing: Remove unnecessary check for EVENT_FILE_FL_FREED

The event_filter_write() function calls event_file_file() to retrieve
a trace_event_file associated with a given file struct. If a non-NULL
pointer is returned, the function then checks whether the trace_event_file
instance has the EVENT_FILE_FL_FREED flag set. This check is redundant
because event_file_file() already performs this validation and returns NULL
if the flag is set. The err value is also already initialized to -ENODEV.

Remove the unnecessary check for EVENT_FILE_FL_FREED in
event_filter_write().

Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Tom Zanussi <zanussi@kernel.org>
Link: https://patch.msgid.link/20260219162737.314231-4-petr.pavlu@suse.com


Signed-off-by: default avatarPetr Pavlu <petr.pavlu@suse.com>
Signed-off-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
parent 473e470f
Loading
Loading
Loading
Loading
+2 −6
Original line number Diff line number Diff line
@@ -2247,12 +2247,8 @@ event_filter_write(struct file *filp, const char __user *ubuf, size_t cnt,

	mutex_lock(&event_mutex);
	file = event_file_file(filp);
	if (file) {
		if (file->flags & EVENT_FILE_FL_FREED)
			err = -ENODEV;
		else
	if (file)
		err = apply_event_filter(file, buf);
	}
	mutex_unlock(&event_mutex);

	kfree(buf);