atom feed8 messages in org.kernel.vger.kernel-janitors[patch] trace: find the correct ftrac...
FromSent OnAttachments
Dan CarpenterMar 20, 2010 6:19 am 
Steven RostedtMar 20, 2010 6:36 am 
Dan CarpenterMar 20, 2010 6:56 am 
Steven RostedtMar 20, 2010 7:07 am 
Dan CarpenterMar 20, 2010 7:31 am 
Dan CarpenterMar 20, 2010 7:39 am 
Steven RostedtMar 20, 2010 6:08 pm 
walter harmsMar 22, 2010 4:49 am 
Subject:[patch] trace: find the correct ftrace event
From:Dan Carpenter (erro@gmail.com)
Date:Mar 20, 2010 6:19:23 am
List:org.kernel.vger.kernel-janitors

The original code doesn't work because "call" is never NULL there.

Signed-off-by: Dan Carpenter <erro@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;