If one of the events within a system fails to enable when "1" is written to the system "enable" file, it should return an error. Note, some events may still be enabled, but the user should know that something did go wrong.
Showing the changes to kernel/trace (1 of 1 file). Show all
Unified · Split
| @@ -702,6 +702,7 @@ __ftrace_set_clr_event_nolock(struct trace_array *tr, const char *match, · 701 unmodified lines | ||
| 702 | 702 | struct trace_event_call *call; |
| 703 | 703 | const char *name; |
| 704 | 704 | int ret = -EINVAL; |
| 705 | + int eret = 0; | |
| 705 | 706 | |
| 706 | 707 | list_for_each_entry(file, &tr->events, list) { |
| 707 | 708 | |
| @@ -725,9 +726,17 @@ __ftrace_set_clr_event_nolock(struct trace_array *tr, const char *match, · 17 unmodified lines | ||
| 725 | 726 | if (event && strcmp(event, name) != 0) |
| 726 | 727 | continue; |
| 727 | 728 | |
| 728 | − ftrace_event_enable_disable(file, set); | |
| 729 | + ret = ftrace_event_enable_disable(file, set); | |
| 729 | 730 | |
| 730 | − ret = 0; | |
| 731 | + /* | |
| 732 | + * Save the first error and return that. Some events | |
| 733 | + * may still have been enabled, but let the user | |
| 734 | + * know that something went wrong. | |
| 735 | + */ | |
| 736 | + if (ret && !eret) | |
| 737 | + eret = ret; | |
| 738 | + | |
| 739 | + ret = eret; | |
| 731 | 740 | } |
| 732 | 741 | |
| 733 | 742 | return ret; |