diff --git a/tools/perf/util/mmap.c b/tools/perf/util/mmap.c index 8c1d033638c2478a3edf82dde8fdd1bba5f81235..2933942abfe252edf0c5f6387cc23bb54a602f5b 100644 --- a/tools/perf/util/mmap.c +++ b/tools/perf/util/mmap.c @@ -76,8 +76,9 @@ static union perf_event *perf_mmap__read(struct perf_mmap *map, * perf_mmap__read_done() */ union perf_event *perf_mmap__read_event(struct perf_mmap *map, - bool overwrite, - u64 *startp, u64 end) + bool overwrite __maybe_unused, + u64 *startp __maybe_unused, + u64 end __maybe_unused) { union perf_event *event; @@ -87,17 +88,14 @@ union perf_event *perf_mmap__read_event(struct perf_mmap *map, if (!refcount_read(&map->refcnt)) return NULL; - if (startp == NULL) - return NULL; - /* non-overwirte doesn't pause the ringbuffer */ - if (!overwrite) - end = perf_mmap__read_head(map); + if (!map->overwrite) + map->end = perf_mmap__read_head(map); - event = perf_mmap__read(map, startp, end); + event = perf_mmap__read(map, &map->start, map->end); - if (!overwrite) - map->prev = *startp; + if (!map->overwrite) + map->prev = map->start; return event; }