提交 52e02834 编写于 作者: T Taeung Song 提交者: Arnaldo Carvalho de Melo

perf tools: Modify error code for when perf_session__new() fails

Because perf_session__new() can fail for more reasons than just ENOMEM,
modify error code(ENOMEM or EINVAL) to -1.
Signed-off-by: NTaeung Song <treeze.taeung@gmail.com>
Acked-by: NJiri Olsa <jolsa@kernel.org>
Acked-by: NNamhyung Kim <namhyung@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: http://lkml.kernel.org/r/1411522417-9917-1-git-send-email-treeze.taeung@gmail.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
上级 a5c2a4c9
......@@ -340,7 +340,7 @@ int cmd_annotate(int argc, const char **argv, const char *prefix __maybe_unused)
annotate.session = perf_session__new(&file, false, &annotate.tool);
if (annotate.session == NULL)
return -ENOMEM;
return -1;
symbol_conf.priv_size = sizeof(struct annotation);
symbol_conf.try_vmlinux_path = true;
......
......@@ -683,7 +683,7 @@ static int __cmd_diff(void)
d->session = perf_session__new(&d->file, false, &tool);
if (!d->session) {
pr_err("Failed to open %s\n", d->file.path);
ret = -ENOMEM;
ret = -1;
goto out_delete;
}
......
......@@ -28,7 +28,7 @@ static int __cmd_evlist(const char *file_name, struct perf_attr_details *details
session = perf_session__new(&file, 0, NULL);
if (session == NULL)
return -ENOMEM;
return -1;
evlist__for_each(session->evlist, pos)
perf_evsel__fprintf(pos, details, stdout);
......
......@@ -460,7 +460,7 @@ int cmd_inject(int argc, const char **argv, const char *prefix __maybe_unused)
file.path = inject.input_name;
inject.session = perf_session__new(&file, true, &inject.tool);
if (inject.session == NULL)
return -ENOMEM;
return -1;
if (symbol__init(&inject.session->header.env) < 0)
return -1;
......
......@@ -698,7 +698,7 @@ int cmd_kmem(int argc, const char **argv, const char *prefix __maybe_unused)
session = perf_session__new(&file, false, &perf_kmem);
if (session == NULL)
return -ENOMEM;
return -1;
symbol__init(&session->header.env);
......
......@@ -1058,7 +1058,7 @@ static int read_events(struct perf_kvm_stat *kvm)
kvm->session = perf_session__new(&file, false, &kvm->tool);
if (!kvm->session) {
pr_err("Initializing perf session failed\n");
return -EINVAL;
return -1;
}
symbol__init(&kvm->session->header.env);
......@@ -1361,7 +1361,7 @@ static int kvm_events_live(struct perf_kvm_stat *kvm,
*/
kvm->session = perf_session__new(&file, false, &kvm->tool);
if (kvm->session == NULL) {
err = -ENOMEM;
err = -1;
goto out;
}
kvm->session->evlist = kvm->evlist;
......
......@@ -862,7 +862,7 @@ static int __cmd_report(bool display_info)
session = perf_session__new(&file, false, &eops);
if (!session) {
pr_err("Initializing perf session failed\n");
return -ENOMEM;
return -1;
}
symbol__init(&session->header.env);
......
......@@ -124,7 +124,7 @@ static int report_raw_events(struct perf_mem *mem)
&mem->tool);
if (session == NULL)
return -ENOMEM;
return -1;
if (mem->cpu_list) {
ret = perf_session__cpu_bitmap(session, mem->cpu_list,
......
......@@ -720,7 +720,7 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused)
repeat:
session = perf_session__new(&file, false, &report.tool);
if (session == NULL)
return -ENOMEM;
return -1;
if (report.queue_size) {
ordered_events__set_alloc_size(&session->ordered_events,
......
......@@ -1744,7 +1744,7 @@ int cmd_script(int argc, const char **argv, const char *prefix __maybe_unused)
session = perf_session__new(&file, false, &script.tool);
if (session == NULL)
return -ENOMEM;
return -1;
if (header || header_only) {
perf_session__fprintf_info(session, stdout, show_full_info);
......
......@@ -1605,7 +1605,7 @@ static int __cmd_timechart(struct timechart *tchart, const char *output_name)
int ret = -EINVAL;
if (session == NULL)
return -ENOMEM;
return -1;
symbol__init(&session->header.env);
......
......@@ -929,7 +929,7 @@ static int __cmd_top(struct perf_top *top)
top->session = perf_session__new(NULL, false, NULL);
if (top->session == NULL)
return -ENOMEM;
return -1;
machines__set_symbol_filter(&top->session->machines, symbol_filter);
......
......@@ -2250,7 +2250,7 @@ static int trace__replay(struct trace *trace)
session = perf_session__new(&file, false, &trace->tool);
if (session == NULL)
return -ENOMEM;
return -1;
if (symbol__init(&session->header.env) < 0)
goto out;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册