Skip to content

Commit bc7e5d2

Browse files
nathanchanceshuahkh
authored andcommitted
selftests: timers: ksft_exit functions do not return
After commit f7d5bcd ("selftests: kselftest: Mark functions that unconditionally call exit() as __noreturn"), ksft_exit_...() functions are marked as __noreturn, which means the return type should not be 'int' but 'void' because they are not returning anything (and never were since exit() has always been called). To facilitate updating the return type of these functions, remove 'return' before the calls to ksft_exit_...(), as __noreturn prevents the compiler from warning that a caller of the ksft_exit functions does not return a value because the program will terminate upon calling these functions. Reviewed-by: Muhammad Usama Anjum <[email protected]> Reviewed-by: Thomas Gleixner <[email protected]> Signed-off-by: Nathan Chancellor <[email protected]> Signed-off-by: Shuah Khan <[email protected]>
1 parent 102690b commit bc7e5d2

16 files changed

+40
-40
lines changed

tools/testing/selftests/timers/adjtick.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ int main(int argc, char **argv)
205205
adjtimex(&tx1);
206206

207207
if (err)
208-
return ksft_exit_fail();
208+
ksft_exit_fail();
209209

210-
return ksft_exit_pass();
210+
ksft_exit_pass();
211211
}

tools/testing/selftests/timers/alarmtimer-suspend.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,6 @@ int main(void)
173173
timer_delete(tm1);
174174
}
175175
if (final_ret)
176-
return ksft_exit_fail();
177-
return ksft_exit_pass();
176+
ksft_exit_fail();
177+
ksft_exit_pass();
178178
}

tools/testing/selftests/timers/change_skew.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ int main(int argc, char **argv)
8989

9090
if (ret) {
9191
printf("[FAIL]");
92-
return ksft_exit_fail();
92+
ksft_exit_fail();
9393
}
9494
printf("[OK]");
95-
return ksft_exit_pass();
95+
ksft_exit_pass();
9696
}

tools/testing/selftests/timers/freq-step.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ int main(int argc, char **argv)
257257
set_frequency(0.0);
258258

259259
if (fails)
260-
return ksft_exit_fail();
260+
ksft_exit_fail();
261261

262-
return ksft_exit_pass();
262+
ksft_exit_pass();
263263
}

tools/testing/selftests/timers/leap-a-day.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ int main(int argc, char **argv)
268268
if (ret < 0) {
269269
printf("Error: Problem setting STA_INS/STA_DEL!: %s\n",
270270
time_state_str(ret));
271-
return ksft_exit_fail();
271+
ksft_exit_fail();
272272
}
273273

274274
/* Validate STA_INS was set */
@@ -277,7 +277,7 @@ int main(int argc, char **argv)
277277
if (tx.status != STA_INS && tx.status != STA_DEL) {
278278
printf("Error: STA_INS/STA_DEL not set!: %s\n",
279279
time_state_str(ret));
280-
return ksft_exit_fail();
280+
ksft_exit_fail();
281281
}
282282

283283
if (tai_time) {
@@ -295,7 +295,7 @@ int main(int argc, char **argv)
295295
se.sigev_value.sival_int = 0;
296296
if (timer_create(CLOCK_REALTIME, &se, &tm1) == -1) {
297297
printf("Error: timer_create failed\n");
298-
return ksft_exit_fail();
298+
ksft_exit_fail();
299299
}
300300
its1.it_value.tv_sec = next_leap;
301301
its1.it_value.tv_nsec = 0;
@@ -366,13 +366,13 @@ int main(int argc, char **argv)
366366
if (error_found) {
367367
printf("Errors observed\n");
368368
clear_time_state();
369-
return ksft_exit_fail();
369+
ksft_exit_fail();
370370
}
371371
printf("\n");
372372
if ((iterations != -1) && !(--iterations))
373373
break;
374374
}
375375

376376
clear_time_state();
377-
return ksft_exit_pass();
377+
ksft_exit_pass();
378378
}

tools/testing/selftests/timers/leapcrash.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ int main(void)
8787
tv.tv_usec = 0;
8888
if (settimeofday(&tv, NULL)) {
8989
printf("Error: You're likely not running with proper (ie: root) permissions\n");
90-
return ksft_exit_fail();
90+
ksft_exit_fail();
9191
}
9292
tx.modes = 0;
9393
adjtimex(&tx);
@@ -104,5 +104,5 @@ int main(void)
104104
fflush(stdout);
105105
}
106106
printf("[OK]\n");
107-
return ksft_exit_pass();
107+
ksft_exit_pass();
108108
}

tools/testing/selftests/timers/mqueue-lat.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@ int main(int argc, char **argv)
107107
ret = mqueue_lat_test();
108108
if (ret < 0) {
109109
printf("[FAILED]\n");
110-
return ksft_exit_fail();
110+
ksft_exit_fail();
111111
}
112112
printf("[OK]\n");
113-
return ksft_exit_pass();
113+
ksft_exit_pass();
114114
}

tools/testing/selftests/timers/posix_timers.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -260,16 +260,16 @@ int main(int argc, char **argv)
260260
ksft_print_msg("based timers if other threads run on the CPU...\n");
261261

262262
if (check_itimer(ITIMER_VIRTUAL) < 0)
263-
return ksft_exit_fail();
263+
ksft_exit_fail();
264264

265265
if (check_itimer(ITIMER_PROF) < 0)
266-
return ksft_exit_fail();
266+
ksft_exit_fail();
267267

268268
if (check_itimer(ITIMER_REAL) < 0)
269-
return ksft_exit_fail();
269+
ksft_exit_fail();
270270

271271
if (check_timer_create(CLOCK_THREAD_CPUTIME_ID) < 0)
272-
return ksft_exit_fail();
272+
ksft_exit_fail();
273273

274274
/*
275275
* It's unfortunately hard to reliably test a timer expiration
@@ -281,10 +281,10 @@ int main(int argc, char **argv)
281281
* find a better solution.
282282
*/
283283
if (check_timer_create(CLOCK_PROCESS_CPUTIME_ID) < 0)
284-
return ksft_exit_fail();
284+
ksft_exit_fail();
285285

286286
if (check_timer_distribution() < 0)
287-
return ksft_exit_fail();
287+
ksft_exit_fail();
288288

289289
ksft_finished();
290290
}

tools/testing/selftests/timers/raw_skew.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,11 +137,11 @@ int main(int argc, char **argv)
137137
if (tx1.offset || tx2.offset ||
138138
tx1.freq != tx2.freq || tx1.tick != tx2.tick) {
139139
printf(" [SKIP]\n");
140-
return ksft_exit_skip("The clock was adjusted externally. Shutdown NTPd or other time sync daemons\n");
140+
ksft_exit_skip("The clock was adjusted externally. Shutdown NTPd or other time sync daemons\n");
141141
}
142142
printf(" [FAILED]\n");
143-
return ksft_exit_fail();
143+
ksft_exit_fail();
144144
}
145145
printf(" [OK]\n");
146-
return ksft_exit_pass();
146+
ksft_exit_pass();
147147
}

tools/testing/selftests/timers/set-2038.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,6 @@ int main(int argc, char *argv[])
128128
/* restore clock */
129129
settime(start);
130130
if (ret)
131-
return ksft_exit_fail();
132-
return ksft_exit_pass();
131+
ksft_exit_fail();
132+
ksft_exit_pass();
133133
}

0 commit comments

Comments
 (0)