lkml.org 
[lkml]   [2010]   [Mar]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[patch] trace: find the correct ftrace event
The original code doesn't work because "call" is never NULL there.

Signed-off-by: Dan Carpenter <error27@gmail.com>
---
My code should work, but it seems like there should but it seems like
there should be a more elegant way to do this?

diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c
index 4615f62..6070c70 100644
--- a/kernel/trace/trace_events_filter.c
+++ b/kernel/trace/trace_events_filter.c
@@ -1388,16 +1388,19 @@ int ftrace_profile_set_filter(struct perf_event *event, int event_id,
struct event_filter *filter;
struct filter_parse_state *ps;
struct ftrace_event_call *call = NULL;
+ int found = 0;

mutex_lock(&event_mutex);

list_for_each_entry(call, &ftrace_events, list) {
- if (call->id == event_id)
+ if (call->id == event_id) {
+ found = 1;
break;
+ }
}

err = -EINVAL;
- if (!call)
+ if (!found)
goto out_unlock;

err = -EEXIST;

\
 
 \ /
  Last update: 2010-03-20 14:29    [W:0.102 / U:1.728 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site