@@ -2888,7 +2888,7 @@ int cs_etm__process_auxtrace_info(union perf_event *event,
2888
2888
int num_cpu , trcidr_idx ;
2889
2889
int err = 0 ;
2890
2890
int i , j ;
2891
- u64 * ptr , * hdr = NULL ;
2891
+ u64 * ptr = NULL ;
2892
2892
u64 * * metadata = NULL ;
2893
2893
u64 hdr_version ;
2894
2894
@@ -2914,15 +2914,8 @@ int cs_etm__process_auxtrace_info(union perf_event *event,
2914
2914
return - EINVAL ;
2915
2915
}
2916
2916
2917
- hdr = zalloc (sizeof (* hdr ) * CS_HEADER_VERSION_MAX );
2918
- if (!hdr )
2919
- return - ENOMEM ;
2920
-
2921
- /* Extract header information - see cs-etm.h for format */
2922
- for (i = 0 ; i < CS_HEADER_VERSION_MAX ; i ++ )
2923
- hdr [i ] = ptr [i ];
2924
- num_cpu = hdr [CS_PMU_TYPE_CPUS ] & 0xffffffff ;
2925
- pmu_type = (unsigned int ) ((hdr [CS_PMU_TYPE_CPUS ] >> 32 ) &
2917
+ num_cpu = ptr [CS_PMU_TYPE_CPUS ] & 0xffffffff ;
2918
+ pmu_type = (unsigned int ) ((ptr [CS_PMU_TYPE_CPUS ] >> 32 ) &
2926
2919
0xffffffff );
2927
2920
2928
2921
if (dump_trace )
@@ -2934,17 +2927,18 @@ int cs_etm__process_auxtrace_info(union perf_event *event,
2934
2927
* in anything other than a sequential array is worth doing.
2935
2928
*/
2936
2929
traceid_list = intlist__new (NULL );
2937
- if (!traceid_list ) {
2938
- err = - ENOMEM ;
2939
- goto err_free_hdr ;
2940
- }
2930
+ if (!traceid_list )
2931
+ return - ENOMEM ;
2941
2932
2942
2933
metadata = zalloc (sizeof (* metadata ) * num_cpu );
2943
2934
if (!metadata ) {
2944
2935
err = - ENOMEM ;
2945
2936
goto err_free_traceid_list ;
2946
2937
}
2947
2938
2939
+ /* Start parsing after the common part of the header */
2940
+ i = CS_HEADER_VERSION_MAX ;
2941
+
2948
2942
/*
2949
2943
* The metadata is stored in the auxtrace_info section and encodes
2950
2944
* the configuration of the ARM embedded trace macrocell which is
@@ -3043,7 +3037,7 @@ int cs_etm__process_auxtrace_info(union perf_event *event,
3043
3037
3044
3038
etm -> num_cpu = num_cpu ;
3045
3039
etm -> pmu_type = pmu_type ;
3046
- etm -> snapshot_mode = (hdr [CS_ETM_SNAPSHOT ] != 0 );
3040
+ etm -> snapshot_mode = (ptr [CS_ETM_SNAPSHOT ] != 0 );
3047
3041
etm -> metadata = metadata ;
3048
3042
etm -> auxtrace_type = auxtrace_info -> type ;
3049
3043
etm -> timeless_decoding = cs_etm__is_timeless_decoding (etm );
@@ -3110,7 +3104,5 @@ int cs_etm__process_auxtrace_info(union perf_event *event,
3110
3104
zfree (& metadata );
3111
3105
err_free_traceid_list :
3112
3106
intlist__delete (traceid_list );
3113
- err_free_hdr :
3114
- zfree (& hdr );
3115
3107
return err ;
3116
3108
}
0 commit comments