Message ID | 20190428083228.20246-2-leo.yan@linaro.org |
---|---|
State | Accepted |
Commit | cf0c37b6dbf74fb71bea07b516612d29e00dcbc4 |
Headers | show |
Series | [v1,1/2] perf cs-etm: Always allocate memory for cs_etm_queue::prev_packet | expand |
On 28/04/2019 09:32, Leo Yan wrote: > Since cs_etm_queue::prev_packet is allocated for all cases, it will > never be NULL pointer; now validity checking prev_packet is pointless, > remove all of them. > > Signed-off-by: Leo Yan <leo.yan@linaro.org> > --- > tools/perf/util/cs-etm.c | 6 +----- > 1 file changed, 1 insertion(+), 5 deletions(-) Tested-by: Robert Walker <robert.walker@arm.com> Regards Rob > diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c > index 054b480aab04..de488b43f440 100644 > --- a/tools/perf/util/cs-etm.c > +++ b/tools/perf/util/cs-etm.c > @@ -979,7 +979,6 @@ static int cs_etm__sample(struct cs_etm_queue *etmq) > * PREV_PACKET is a branch. > */ > if (etm->synth_opts.last_branch && > - etmq->prev_packet && > etmq->prev_packet->sample_type == CS_ETM_RANGE && > etmq->prev_packet->last_instr_taken_branch) > cs_etm__update_last_branch_rb(etmq); > @@ -1012,7 +1011,7 @@ static int cs_etm__sample(struct cs_etm_queue *etmq) > etmq->period_instructions = instrs_over; > } > > - if (etm->sample_branches && etmq->prev_packet) { > + if (etm->sample_branches) { > bool generate_sample = false; > > /* Generate sample for tracing on packet */ > @@ -1069,9 +1068,6 @@ static int cs_etm__flush(struct cs_etm_queue *etmq) > struct cs_etm_auxtrace *etm = etmq->etm; > struct cs_etm_packet *tmp; > > - if (!etmq->prev_packet) > - return 0; > - > /* Handle start tracing packet */ > if (etmq->prev_packet->sample_type == CS_ETM_EMPTY) > goto swap_packet;
diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c index 054b480aab04..de488b43f440 100644 --- a/tools/perf/util/cs-etm.c +++ b/tools/perf/util/cs-etm.c @@ -979,7 +979,6 @@ static int cs_etm__sample(struct cs_etm_queue *etmq) * PREV_PACKET is a branch. */ if (etm->synth_opts.last_branch && - etmq->prev_packet && etmq->prev_packet->sample_type == CS_ETM_RANGE && etmq->prev_packet->last_instr_taken_branch) cs_etm__update_last_branch_rb(etmq); @@ -1012,7 +1011,7 @@ static int cs_etm__sample(struct cs_etm_queue *etmq) etmq->period_instructions = instrs_over; } - if (etm->sample_branches && etmq->prev_packet) { + if (etm->sample_branches) { bool generate_sample = false; /* Generate sample for tracing on packet */ @@ -1069,9 +1068,6 @@ static int cs_etm__flush(struct cs_etm_queue *etmq) struct cs_etm_auxtrace *etm = etmq->etm; struct cs_etm_packet *tmp; - if (!etmq->prev_packet) - return 0; - /* Handle start tracing packet */ if (etmq->prev_packet->sample_type == CS_ETM_EMPTY) goto swap_packet;
Since cs_etm_queue::prev_packet is allocated for all cases, it will never be NULL pointer; now validity checking prev_packet is pointless, remove all of them. Signed-off-by: Leo Yan <leo.yan@linaro.org> --- tools/perf/util/cs-etm.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) -- 2.17.1