aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/session.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/util/session.c')
-rw-r--r--tools/perf/util/session.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index 1951e330377c..8e7c1896eaa2 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -70,8 +70,17 @@ struct perf_session *perf_session__new(const char *filename, int mode, bool forc
70 self->unknown_events = 0; 70 self->unknown_events = 0;
71 map_groups__init(&self->kmaps); 71 map_groups__init(&self->kmaps);
72 72
73 if (mode == O_RDONLY && perf_session__open(self, force) < 0) 73 if (mode == O_RDONLY) {
74 goto out_delete; 74 if (perf_session__open(self, force) < 0)
75 goto out_delete;
76 } else if (mode == O_WRONLY) {
77 /*
78 * In O_RDONLY mode this will be performed when reading the
79 * kernel MMAP event, in event__process_mmap().
80 */
81 if (perf_session__create_kernel_maps(self) < 0)
82 goto out_delete;
83 }
75 84
76 self->sample_type = perf_header__sample_type(&self->header); 85 self->sample_type = perf_header__sample_type(&self->header);
77out: 86out: