From: Arnaldo Carvalho de Melo Date: Thu, 22 Jan 2015 14:08:04 +0000 (-0300) Subject: perf trace: Fix error reporting for evsel pgfault constructor X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=5ed08dae9d2f2307c103e2dce94d801e74aefae4;p=linux-beck.git perf trace: Fix error reporting for evsel pgfault constructor In that case the only failure possible is not to have enough memory, as we are just creating the evsels, not trying to access any system facility such as debugfs files or syscalls. Cc: Adrian Hunter Cc: Borislav Petkov Cc: David Ahern Cc: Don Zickus Cc: Frederic Weisbecker Cc: Jiri Olsa Cc: Namhyung Kim Cc: Stephane Eranian Link: http://lkml.kernel.org/n/tip-7k6asvfhiwiu2zs6o2oknchk@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c index 684609d7a83d..eaaa540bf1f3 100644 --- a/tools/perf/builtin-trace.c +++ b/tools/perf/builtin-trace.c @@ -2063,18 +2063,12 @@ static int trace__run(struct trace *trace, int argc, const char **argv) if ((trace->trace_pgfaults & TRACE_PFMAJ) && perf_evlist__add_pgfault(evlist, PERF_COUNT_SW_PAGE_FAULTS_MAJ)) { - /* - * FIXME: This one needs better error handling, as by now we - * already checked that debugfs is mounted and that we have access to it, - * so probably the case is that something is busted wrt this specific - * software event, ditto for the next gotos to out_error_tp... - */ - goto out_error_tp; + goto out_error_mem; } if ((trace->trace_pgfaults & TRACE_PFMIN) && perf_evlist__add_pgfault(evlist, PERF_COUNT_SW_PAGE_FAULTS_MIN)) - goto out_error_tp; + goto out_error_mem; if (trace->sched && perf_evlist__add_newtp(evlist, "sched", "sched_stat_runtime", @@ -2225,6 +2219,9 @@ out_error: fprintf(trace->output, "%s\n", errbuf); goto out_delete_evlist; } +out_error_mem: + fprintf(trace->output, "Not enough memory to run!\n"); + goto out_delete_evlist; } static int trace__replay(struct trace *trace)