Re: [PATCH 3/4] ftrace: No return value for ftrace_process_locs

From: Jiri Olsa
Date: Sat May 12 2012 - 11:02:31 EST


On Tue, May 08, 2012 at 10:19:20AM -0400, Steven Rostedt wrote:
> On Wed, 2012-04-25 at 10:23 +0200, Jiri Olsa wrote:
> > The return value of ftrace_process_locs is never checked. The function
> > tries to update as many calls as possible and in case of error there's
> > either warning output or ftrace_bug call.
> >
> > Signed-off-by: Jiri Olsa <jolsa@xxxxxxxxxx>
> > ---
> > kernel/trace/ftrace.c | 37 ++++++++++++++++---------------------
> > 1 files changed, 16 insertions(+), 21 deletions(-)
> >
> > diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
> > index b3ceecd..e67f5b3 100644
> > --- a/kernel/trace/ftrace.c
> > +++ b/kernel/trace/ftrace.c
> > @@ -1930,7 +1930,7 @@ static int ops_traces_mod(struct ftrace_ops *ops)
> > return ftrace_hash_empty(hash);
> > }
> >
> > -static int ftrace_update_code(struct module *mod)
> > +static void ftrace_update_code(struct module *mod)
> > {
> > struct ftrace_page *pg;
> > struct dyn_ftrace *p;
> > @@ -1959,7 +1959,7 @@ static int ftrace_update_code(struct module *mod)
> > for (i = 0; i < pg->index; i++) {
> > /* If something went wrong, bail without enabling anything */
> > if (unlikely(ftrace_disabled))
> > - return -1;
> > + return;
> >
> > p = &pg->records[i];
> > p->flags = ref;
> > @@ -1968,8 +1968,8 @@ static int ftrace_update_code(struct module *mod)
> > * Do the initial record conversion from mcount jump
> > * to the NOP instructions.
> > */
> > - if (!ftrace_code_disable(mod, p))
> > - break;
> > + if (WARN_ON_ONCE(!ftrace_code_disable(mod, p)))
> > + return;
>
> Why the warning? If ftrace_disabled is set, something broke a long time
> ago, and the ftrace_bug gives its own warning.
>
> I don't think this is needed.

right, I missed the ftrace_disabled case..

About the ftrace_update_code/ftrace_process_locs return values..
I still think the void is better, because we dont change the code
path in case it fails and all errors are already reported.

jirka
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/