@@ -140,7 +140,7 @@ static void amd_pstate_ut_check_perf(u32 index)
140
140
if (ret ) {
141
141
amd_pstate_ut_cases [index ].result = AMD_PSTATE_UT_RESULT_FAIL ;
142
142
pr_err ("%s cppc_get_perf_caps ret=%d error!\n" , __func__ , ret );
143
- return ;
143
+ goto skip_test ;
144
144
}
145
145
146
146
nominal_perf = cppc_perf .nominal_perf ;
@@ -151,7 +151,7 @@ static void amd_pstate_ut_check_perf(u32 index)
151
151
if (ret ) {
152
152
amd_pstate_ut_cases [index ].result = AMD_PSTATE_UT_RESULT_FAIL ;
153
153
pr_err ("%s read CPPC_CAP1 ret=%d error!\n" , __func__ , ret );
154
- return ;
154
+ goto skip_test ;
155
155
}
156
156
157
157
nominal_perf = AMD_CPPC_NOMINAL_PERF (cap1 );
@@ -169,7 +169,7 @@ static void amd_pstate_ut_check_perf(u32 index)
169
169
nominal_perf , cpudata -> nominal_perf ,
170
170
lowest_nonlinear_perf , cpudata -> lowest_nonlinear_perf ,
171
171
lowest_perf , cpudata -> lowest_perf );
172
- return ;
172
+ goto skip_test ;
173
173
}
174
174
175
175
if (!((highest_perf >= nominal_perf ) &&
@@ -180,11 +180,15 @@ static void amd_pstate_ut_check_perf(u32 index)
180
180
pr_err ("%s cpu%d highest=%d >= nominal=%d > lowest_nonlinear=%d > lowest=%d > 0, the formula is incorrect!\n" ,
181
181
__func__ , cpu , highest_perf , nominal_perf ,
182
182
lowest_nonlinear_perf , lowest_perf );
183
- return ;
183
+ goto skip_test ;
184
184
}
185
+ cpufreq_cpu_put (policy );
185
186
}
186
187
187
188
amd_pstate_ut_cases [index ].result = AMD_PSTATE_UT_RESULT_PASS ;
189
+ return ;
190
+ skip_test :
191
+ cpufreq_cpu_put (policy );
188
192
}
189
193
190
194
/*
@@ -212,14 +216,14 @@ static void amd_pstate_ut_check_freq(u32 index)
212
216
pr_err ("%s cpu%d max=%d >= nominal=%d > lowest_nonlinear=%d > min=%d > 0, the formula is incorrect!\n" ,
213
217
__func__ , cpu , cpudata -> max_freq , cpudata -> nominal_freq ,
214
218
cpudata -> lowest_nonlinear_freq , cpudata -> min_freq );
215
- return ;
219
+ goto skip_test ;
216
220
}
217
221
218
222
if (cpudata -> min_freq != policy -> min ) {
219
223
amd_pstate_ut_cases [index ].result = AMD_PSTATE_UT_RESULT_FAIL ;
220
224
pr_err ("%s cpu%d cpudata_min_freq=%d policy_min=%d, they should be equal!\n" ,
221
225
__func__ , cpu , cpudata -> min_freq , policy -> min );
222
- return ;
226
+ goto skip_test ;
223
227
}
224
228
225
229
if (cpudata -> boost_supported ) {
@@ -231,16 +235,20 @@ static void amd_pstate_ut_check_freq(u32 index)
231
235
pr_err ("%s cpu%d policy_max=%d should be equal cpu_max=%d or cpu_nominal=%d !\n" ,
232
236
__func__ , cpu , policy -> max , cpudata -> max_freq ,
233
237
cpudata -> nominal_freq );
234
- return ;
238
+ goto skip_test ;
235
239
}
236
240
} else {
237
241
amd_pstate_ut_cases [index ].result = AMD_PSTATE_UT_RESULT_FAIL ;
238
242
pr_err ("%s cpu%d must support boost!\n" , __func__ , cpu );
239
- return ;
243
+ goto skip_test ;
240
244
}
245
+ cpufreq_cpu_put (policy );
241
246
}
242
247
243
248
amd_pstate_ut_cases [index ].result = AMD_PSTATE_UT_RESULT_PASS ;
249
+ return ;
250
+ skip_test :
251
+ cpufreq_cpu_put (policy );
244
252
}
245
253
246
254
static int __init amd_pstate_ut_init (void )
0 commit comments