From: Dan Carpenter <error27@gmail.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Ingo Molnar <mingo@redhat.com>,
Frederic Weisbecker <fweisbec@gmail.com>,
Li Zefan <lizf@cn.fujitsu.com>, Tom Zanussi <tzanussi@gmail.com>,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [patch] trace: find the correct ftrace event
Date: Sat, 20 Mar 2010 16:56:04 +0300 [thread overview]
Message-ID: <20100320135604.GA28881@bicker> (raw)
In-Reply-To: <1269092233.28658.9.camel@localhost>
On Sat, Mar 20, 2010 at 09:37:13AM -0400, Steven Rostedt wrote:
> On Sat, 2010-03-20 at 16:19 +0300, Dan Carpenter wrote:
> > The original code doesn't work because "call" is never NULL there.
>
> A one line change would have done the same ;-)
>
> > 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 (call == &ftrace_events)
>
Man... That makes my head hurt. It only works because ->list is the
first element in the struct.
We'd need a cast.
Is that really cleaner?
regards,
dan carpenter
> -- Steve
>
> > + if (!found)
> > goto out_unlock;
> >
> > err = -EEXIST;
>
>
> --
> 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/
next prev parent reply other threads:[~2010-03-20 13:56 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-20 13:19 [patch] trace: find the correct ftrace event Dan Carpenter
2010-03-20 13:37 ` Steven Rostedt
2010-03-20 13:56 ` Dan Carpenter [this message]
2010-03-20 14:07 ` Steven Rostedt
2010-03-20 14:31 ` Dan Carpenter
2010-03-20 14:39 ` [patch v2] " Dan Carpenter
2010-03-21 1:09 ` Steven Rostedt
2010-05-07 18:40 ` [tip:perf/core] perf: Fix check at end of event search tip-bot for Dan Carpenter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100320135604.GA28881@bicker \
--to=error27@gmail.com \
--cc=fweisbec@gmail.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lizf@cn.fujitsu.com \
--cc=mingo@redhat.com \
--cc=rostedt@goodmis.org \
--cc=tzanussi@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.