@@ -140,7 +140,7 @@ static void amd_pstate_ut_check_perf(u32 index)
140140 if (ret ) {
141141 amd_pstate_ut_cases [index ].result = AMD_PSTATE_UT_RESULT_FAIL ;
142142 pr_err ("%s cppc_get_perf_caps ret=%d error!\n" , __func__ , ret );
143- return ;
143+ goto skip_test ;
144144 }
145145
146146 nominal_perf = cppc_perf .nominal_perf ;
@@ -151,7 +151,7 @@ static void amd_pstate_ut_check_perf(u32 index)
151151 if (ret ) {
152152 amd_pstate_ut_cases [index ].result = AMD_PSTATE_UT_RESULT_FAIL ;
153153 pr_err ("%s read CPPC_CAP1 ret=%d error!\n" , __func__ , ret );
154- return ;
154+ goto skip_test ;
155155 }
156156
157157 nominal_perf = AMD_CPPC_NOMINAL_PERF (cap1 );
@@ -169,7 +169,7 @@ static void amd_pstate_ut_check_perf(u32 index)
169169 nominal_perf , cpudata -> nominal_perf ,
170170 lowest_nonlinear_perf , cpudata -> lowest_nonlinear_perf ,
171171 lowest_perf , cpudata -> lowest_perf );
172- return ;
172+ goto skip_test ;
173173 }
174174
175175 if (!((highest_perf >= nominal_perf ) &&
@@ -180,11 +180,15 @@ static void amd_pstate_ut_check_perf(u32 index)
180180 pr_err ("%s cpu%d highest=%d >= nominal=%d > lowest_nonlinear=%d > lowest=%d > 0, the formula is incorrect!\n" ,
181181 __func__ , cpu , highest_perf , nominal_perf ,
182182 lowest_nonlinear_perf , lowest_perf );
183- return ;
183+ goto skip_test ;
184184 }
185+ cpufreq_cpu_put (policy );
185186 }
186187
187188 amd_pstate_ut_cases [index ].result = AMD_PSTATE_UT_RESULT_PASS ;
189+ return ;
190+ skip_test :
191+ cpufreq_cpu_put (policy );
188192}
189193
190194/*
@@ -212,14 +216,14 @@ static void amd_pstate_ut_check_freq(u32 index)
212216 pr_err ("%s cpu%d max=%d >= nominal=%d > lowest_nonlinear=%d > min=%d > 0, the formula is incorrect!\n" ,
213217 __func__ , cpu , cpudata -> max_freq , cpudata -> nominal_freq ,
214218 cpudata -> lowest_nonlinear_freq , cpudata -> min_freq );
215- return ;
219+ goto skip_test ;
216220 }
217221
218222 if (cpudata -> min_freq != policy -> min ) {
219223 amd_pstate_ut_cases [index ].result = AMD_PSTATE_UT_RESULT_FAIL ;
220224 pr_err ("%s cpu%d cpudata_min_freq=%d policy_min=%d, they should be equal!\n" ,
221225 __func__ , cpu , cpudata -> min_freq , policy -> min );
222- return ;
226+ goto skip_test ;
223227 }
224228
225229 if (cpudata -> boost_supported ) {
@@ -231,16 +235,20 @@ static void amd_pstate_ut_check_freq(u32 index)
231235 pr_err ("%s cpu%d policy_max=%d should be equal cpu_max=%d or cpu_nominal=%d !\n" ,
232236 __func__ , cpu , policy -> max , cpudata -> max_freq ,
233237 cpudata -> nominal_freq );
234- return ;
238+ goto skip_test ;
235239 }
236240 } else {
237241 amd_pstate_ut_cases [index ].result = AMD_PSTATE_UT_RESULT_FAIL ;
238242 pr_err ("%s cpu%d must support boost!\n" , __func__ , cpu );
239- return ;
243+ goto skip_test ;
240244 }
245+ cpufreq_cpu_put (policy );
241246 }
242247
243248 amd_pstate_ut_cases [index ].result = AMD_PSTATE_UT_RESULT_PASS ;
249+ return ;
250+ skip_test :
251+ cpufreq_cpu_put (policy );
244252}
245253
246254static int __init amd_pstate_ut_init (void )
0 commit comments