lkml.org 
[lkml]   [2011]   [Aug]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [RFC 2/4] perf, ftrace: Add filter support for ftrace:function tracepoint
From
Date
Hi Jiri,

Sorry for the late response, I've been catching up on lots of other
things.


On Mon, 2011-07-11 at 15:22 +0200, Jiri Olsa wrote:

> +int ftrace_function_rec_ip(char *func, unsigned long long *ip)
> +{
> + struct ftrace_page *pg;
> + struct dyn_ftrace *rec;
> + int len = strlen(func);
> + int found = 0;
> +
> + mutex_lock(&ftrace_lock);
> +
> + do_for_each_ftrace_rec(pg, rec) {
> + if (!ftrace_match_record(rec, NULL, func, len, MATCH_FULL))
> + continue;
> +
> + *ip = rec->ip;
> + found = 1;
> + break;

You can't use break here. The do_for_each_ftrace_rec() { }
while_for_each_ftrace_rec(); is a double loop. The break exits the first
loop, but then continues to the next loop. You must use a goto.
-- Steve

> + } while_for_each_ftrace_rec();
> +
> + mutex_unlock(&ftrace_lock);
> +
> + return found ? 0 : -EINVAL;
> +}
> +




\
 
 \ /
  Last update: 2011-08-10 21:37    [from the cache]
©2003-2011 Jasper Spaans