File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -101,16 +101,18 @@ int populate_cache_leaves(unsigned int cpu)
101
101
unsigned int level , idx ;
102
102
enum cache_type type ;
103
103
struct cpu_cacheinfo * this_cpu_ci = get_cpu_cacheinfo (cpu );
104
- struct cacheinfo * this_leaf = this_cpu_ci -> info_list ;
104
+ struct cacheinfo * infos = this_cpu_ci -> info_list ;
105
105
106
106
for (idx = 0 , level = 1 ; level <= this_cpu_ci -> num_levels &&
107
- idx < this_cpu_ci -> num_leaves ; idx ++ , level ++ ) {
107
+ idx < this_cpu_ci -> num_leaves ; level ++ ) {
108
108
type = get_cache_type (level );
109
109
if (type == CACHE_TYPE_SEPARATE ) {
110
- ci_leaf_init (this_leaf ++ , CACHE_TYPE_DATA , level );
111
- ci_leaf_init (this_leaf ++ , CACHE_TYPE_INST , level );
110
+ if (idx + 1 >= this_cpu_ci -> num_leaves )
111
+ break ;
112
+ ci_leaf_init (& infos [idx ++ ], CACHE_TYPE_DATA , level );
113
+ ci_leaf_init (& infos [idx ++ ], CACHE_TYPE_INST , level );
112
114
} else {
113
- ci_leaf_init (this_leaf ++ , type , level );
115
+ ci_leaf_init (& infos [ idx ++ ] , type , level );
114
116
}
115
117
}
116
118
return 0 ;
You can’t perform that action at this time.
0 commit comments