Messages in this thread | | | Date | Thu, 15 Oct 2009 17:47:54 +0800 | Subject | Re: [PATCH 3/4] tracing/profile: Add filter support | From | Américo Wang <> |
| |
On Thu, Oct 15, 2009 at 11:21 AM, Li Zefan <lizf@cn.fujitsu.com> wrote: > - Add an ioctl to allocate a filter for a perf event. > > - Free the filter when the associated perf event is to be freed. > > - Do the filtering in perf_swevent_match(). > > Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
{snip}
> +int ftrace_profile_set_filter(struct perf_event *event, int event_id, > + char *filter_str) > +{ > + int err; > + struct event_filter *filter; > + struct filter_parse_state *ps; > + struct ftrace_event_call *call = NULL; > + > + mutex_lock(&event_mutex); > + > + list_for_each_entry(call, &ftrace_events, list) { > + if (call->id == event_id) > + break; > + } > + if (!call) > + return -EINVAL; > + > + if (event->filter) > + return -EEXIST; > + > + filter = __alloc_preds(); > + if (IS_ERR(filter)) > + return PTR_ERR(filter);
Just return will leave &event_mutex locked...
Am I missing something here?
> + > + err = -ENOMEM; > + ps = kzalloc(sizeof(*ps), GFP_KERNEL); > + if (!ps) > + goto free_preds; > + > + parse_init(ps, filter_ops, filter_str); > + err = filter_parse(ps); > + if (err) > + goto free_ps; > + > + err = replace_preds(call, filter, ps, filter_str, false); > + if (!err) > + event->filter = filter; > + > +free_ps: > + filter_opstack_clear(ps); > + postfix_clear(ps); > + kfree(ps); > + > +free_preds: > + if (err) > + __free_preds(filter); > + > + mutex_unlock(&event_mutex); > + > + return err; > +} > + -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |