diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 1abf6919b8a2..27679ab38511 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -766,7 +766,8 @@ void perf_evsel__config(struct perf_evsel *evsel, struct
record_opts *opts)
if (opts->clockid >= 0) {
attr->use_clockid = 1;
attr->clockid = opts->clockid;
- }
+ } else
+ attr->clockid = -1;
}
No, we must not have a !0 value in ->clockid when we do not set
use_clockid. The kernel checks for nonzero tail values.