diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c index 663d6eda0822b2a8a1d07e2e8244e82d6f602ce0..dc7d704735bd535d33e4e05fbe62b689ab4d09f4 100644 --- a/tools/perf/builtin-kvm.c +++ b/tools/perf/builtin-kvm.c @@ -933,10 +933,10 @@ static int kvm_events_live_report(struct perf_kvm_stat *kvm) nr_fds++; - if (perf_evlist__add_pollfd(kvm->evlist, fileno(stdin)) < 0) + nr_stdin = perf_evlist__add_pollfd(kvm->evlist, fileno(stdin)); + if (nr_stdin < 0) goto out; - nr_stdin = nr_fds; nr_fds++; if (fd_set_nonblock(fileno(stdin)) != 0) goto out;