Skip to contentSkip to conversation

perf record: Fix s390 random record__auxtrace_init return value

PATCH New Thomas Richter 2 participants 2 messages Apr 23, 2018 – Apr 26, 2018 perf events

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 perf record: Fix s390 random record__auxtrace_init return value

Command perf record calls
cmd_report

+---> record__auxtrace_init
      +---> auxtrace_record__init()

On s390 function auxtrace_record__init() returns random return value due to missing initialization.
This sometime causes perf record to exit immediately without error message and creating a perf.data file.

Fix this by setting error return code to zero before return from platform specific function which does not set the error code in call cases.

---
 tools/perf/arch/s390/util/auxtrace.c | 1 +
 1 file changed, 1 insertion(+)
tools/perf/arch/s390/util/auxtrace.c +1 -0
index 6cb48e4cffd9..3afe8256eff2 100644
@@ -87,6 +87,7 @@ struct auxtrace_record *auxtrace_record__init(struct perf_evlist *evlist,
 	struct perf_evsel *pos;
 	int diagnose = 0;
 
+	*err = 0;
 	if (evlist->nr_entries == 0)
 		return NULL;
 
Signature · 1 line
2.14.3
#1 lore raw

[tip:perf/urgent] perf record: Fix s390 undefined record__auxtrace_init() return value

perf record: Fix s390 undefined record__auxtrace_init() return value
Commit-ID:  5d9946c3e5e38e07ab7019db9413a96807a325f2
Gitweb:     https://git.kernel.org/tip/5d9946c3e5e38e07ab7019db9413a96807a325f2
Author:     Thomas Richter <[email protected]>
AuthorDate: Mon, 23 Apr 2018 16:29:40 +0200
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Mon, 23 Apr 2018 12:05:02 -0300

perf record: Fix s390 undefined record__auxtrace_init() return value

Command 'perf record' calls:

cmd_report()
record__auxtrace_init()
auxtrace_record__init()

On s390 function auxtrace_record__init() returns random return value due to missing initialization.

This sometime causes 'perf record' to exit immediately without error message and creating a perf.data file.

Fix this by setting error the return code to zero before returning from platform specific functions which may not set the error code in call cases.

---
 tools/perf/arch/s390/util/auxtrace.c | 1 +
 1 file changed, 1 insertion(+)
tools/perf/arch/s390/util/auxtrace.c +1 -0
index 6cb48e4cffd9..3afe8256eff2 100644
@@ -87,6 +87,7 @@ struct auxtrace_record *auxtrace_record__init(struct perf_evlist *evlist,
 	struct perf_evsel *pos;
 	int diagnose = 0;
 
+	*err = 0;
 	if (evlist->nr_entries == 0)
 		return NULL;