Re: [PATCH] perf lock: fix segfault with info subcommand followingmove to libtraceevent

From: Arnaldo Carvalho de Melo
Date: Fri Jul 06 2012 - 14:12:06 EST


Em Fri, Jul 06, 2012 at 10:02:18AM -0600, David Ahern escreveu:
> +++ b/tools/perf/builtin-lock.c
> @@ -877,6 +877,9 @@ static int read_events(void)
> if (!session)
> die("Initializing perf session failed\n");
>
> + if (!perf_session__has_traces(session, "lock record"))
> + exit(1);
> +
> return perf_session__process_events(session, &eops);
> }

This is getting out of hand, first a die(), then an exit(1) and finally
this function returns a value, ouch.

I'd rather use return to signal that something went wrong and as well
print some helpful warning to the user.

Eventually we should fix all the other offenders, but lets try not to
add even more.

Can you please resend with a pr_warning + return failure?

- Arnaldo
--
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/