Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 52e02834 authored by Taeung Song's avatar Taeung Song Committed by Arnaldo Carvalho de Melo
Browse files

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: default avatarTaeung Song <treeze.taeung@gmail.com>
Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
Acked-by: default avatarNamhyung 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.com


Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent a5c2a4c9
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -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);
	annotate.session = perf_session__new(&file, false, &annotate.tool);
	if (annotate.session == NULL)
	if (annotate.session == NULL)
		return -ENOMEM;
		return -1;


	symbol_conf.priv_size = sizeof(struct annotation);
	symbol_conf.priv_size = sizeof(struct annotation);
	symbol_conf.try_vmlinux_path = true;
	symbol_conf.try_vmlinux_path = true;
+1 −1
Original line number Original line Diff line number Diff line
@@ -683,7 +683,7 @@ static int __cmd_diff(void)
		d->session = perf_session__new(&d->file, false, &tool);
		d->session = perf_session__new(&d->file, false, &tool);
		if (!d->session) {
		if (!d->session) {
			pr_err("Failed to open %s\n", d->file.path);
			pr_err("Failed to open %s\n", d->file.path);
			ret = -ENOMEM;
			ret = -1;
			goto out_delete;
			goto out_delete;
		}
		}


+1 −1
Original line number Original line Diff line number Diff line
@@ -28,7 +28,7 @@ static int __cmd_evlist(const char *file_name, struct perf_attr_details *details


	session = perf_session__new(&file, 0, NULL);
	session = perf_session__new(&file, 0, NULL);
	if (session == NULL)
	if (session == NULL)
		return -ENOMEM;
		return -1;


	evlist__for_each(session->evlist, pos)
	evlist__for_each(session->evlist, pos)
		perf_evsel__fprintf(pos, details, stdout);
		perf_evsel__fprintf(pos, details, stdout);
+1 −1
Original line number Original line Diff line number Diff line
@@ -460,7 +460,7 @@ int cmd_inject(int argc, const char **argv, const char *prefix __maybe_unused)
	file.path = inject.input_name;
	file.path = inject.input_name;
	inject.session = perf_session__new(&file, true, &inject.tool);
	inject.session = perf_session__new(&file, true, &inject.tool);
	if (inject.session == NULL)
	if (inject.session == NULL)
		return -ENOMEM;
		return -1;


	if (symbol__init(&inject.session->header.env) < 0)
	if (symbol__init(&inject.session->header.env) < 0)
		return -1;
		return -1;
+1 −1
Original line number Original line Diff line number Diff line
@@ -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);
	session = perf_session__new(&file, false, &perf_kmem);
	if (session == NULL)
	if (session == NULL)
		return -ENOMEM;
		return -1;


	symbol__init(&session->header.env);
	symbol__init(&session->header.env);


Loading