diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index 46e2772f838ed06f2009194997a82646fa1ce227..515510ecc76a43391e2ac58f830557b51810b466 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c @@ -324,7 +324,10 @@ static int record__open(struct record *rec) } else { pr_err("failed to mmap with %d (%s)\n", errno, strerror_r(errno, msg, sizeof(msg))); - rc = -errno; + if (errno) + rc = -errno; + else + rc = -EINVAL; } goto out; }