Messages in this thread | | | Subject | Re: [RFC 2/4] perf, ftrace: Add filter support for ftrace:function tracepoint | From | Steven Rostedt <> | Date | Wed, 10 Aug 2011 15:34:13 -0400 |
| |
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; > +} > +
| |