Skip to content

Commit 0d16237

Browse files
mdouchametan-ucw
authored andcommitted
Unify error handling in lib/tst_checkpoint.c
- Properly format caller file:line location Signed-off-by: Martin Doucha <[email protected]> Reviewed-by: Cyril Hrubis <[email protected]>
1 parent 375e380 commit 0d16237

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

lib/tst_checkpoint.c

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,8 @@ void tst_checkpoint_init(const char *file, const int lineno,
4343
unsigned int page_size;
4444

4545
if (tst_futexes) {
46-
tst_brkm(TBROK, cleanup_fn,
47-
"%s: %d checkpoints already initialized",
48-
file, lineno);
46+
tst_brkm_(file, lineno, TBROK, cleanup_fn,
47+
"checkpoints already initialized");
4948
return;
5049
}
5150

@@ -61,9 +60,9 @@ void tst_checkpoint_init(const char *file, const int lineno,
6160
* the init as a first function with NULL as cleanup function.
6261
*/
6362
if (cleanup_fn && !tst_tmpdir_created()) {
64-
tst_brkm(TBROK, cleanup_fn,
65-
"%s:%d You have to create test temporary directory "
66-
"first (call tst_tmpdir())", file, lineno);
63+
tst_brkm_(file, lineno, TBROK, cleanup_fn,
64+
"You have to create test temporary directory "
65+
"first (call tst_tmpdir())");
6766
return;
6867
}
6968

@@ -144,9 +143,9 @@ void tst_safe_checkpoint_wait(const char *file, const int lineno,
144143
ret = tst_checkpoint_wait(id, msec_timeout);
145144

146145
if (ret) {
147-
tst_brkm(TBROK | TERRNO, cleanup_fn,
148-
"%s:%d: tst_checkpoint_wait(%u, %i)",
149-
file, lineno, id, msec_timeout);
146+
tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
147+
"tst_checkpoint_wait(%u, %i) failed", id,
148+
msec_timeout);
150149
}
151150
}
152151

@@ -157,8 +156,8 @@ void tst_safe_checkpoint_wake(const char *file, const int lineno,
157156
int ret = tst_checkpoint_wake(id, nr_wake, DEFAULT_MSEC_TIMEOUT);
158157

159158
if (ret) {
160-
tst_brkm(TBROK | TERRNO, cleanup_fn,
161-
"%s:%d: tst_checkpoint_wake(%u, %u, %i)",
162-
file, lineno, id, nr_wake, DEFAULT_MSEC_TIMEOUT);
159+
tst_brkm_(file, lineno, TBROK | TERRNO, cleanup_fn,
160+
"tst_checkpoint_wake(%u, %u, %i) failed", id, nr_wake,
161+
DEFAULT_MSEC_TIMEOUT);
163162
}
164163
}

0 commit comments

Comments
 (0)