[PATCH 13/37] perf intel-pt: Move decoder error setting into one condition

Adrian Hunter
2017-05-19T09:06:20Z

Move decoder error setting into one condition.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
---
tools/perf/util/intel-pt-decoder/intel-pt-decoder.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c b/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c
index 0b6c6f442870..8062655bc112 100644
--- a/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c
+++ b/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c
@@ -2314,14 +2314,17 @@ const struct intel_pt_state *intel_pt_decode(struct intel_pt_decoder *decoder)
}
} while (err == -ENOLINK);

- decoder->state.err = err ? intel_pt_ext_err(err) : 0;
decoder->state.timestamp = decoder->timestamp;
decoder->state.est_timestamp = intel_pt_est_timestamp(decoder);
decoder->state.cr3 = decoder->cr3;
decoder->state.tot_insn_cnt = decoder->tot_insn_cnt;

- if (err)
+ if (err) {
+ decoder->state.err = intel_pt_ext_err(err);
decoder->state.from_ip = decoder->ip;
+ } else {
+ decoder->state.err = 0;
+ }

return &decoder->state;
}
--
1.9.1