History

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().

Petr Pavlu committed 8 months ago

Commit f55c09d1 parent 473e4701 file · +2 −6Browse files

Showing the changes to kernel (1 of 1 file). Show all

Unified · Split

kernel/trace/trace_events.c+2−6
@@ -2247,12 +2247,8 @@ event_filter_write(struct file *filp, const char __user *ubuf, size_t cnt, · 2246 unmodified lines
22472247
22482248 mutex_lock(&event_mutex);
22492249 file = event_file_file(filp);
2250− if (file) {
2251− if (file->flags & EVENT_FILE_FL_FREED)
2252− err = -ENODEV;
2253− else
2254− err = apply_event_filter(file, buf);
2255− }
2250+ if (file)
2251+ err = apply_event_filter(file, buf);
22562252 mutex_unlock(&event_mutex);
22572253
22582254 kfree(buf);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t