exit_with_error() isn't called by test_xsk.c. It shouldn't be called
in the future either, since some resources need to be cleaned before
exiting when an error occurs.

Move the definition of exit_with_error() to xskxceiver.c, where it's
still used.

Signed-off-by: Bastien Curutchet (eBPF Foundation) 
<bastien.curutc...@bootlin.com>
---
 tools/testing/selftests/bpf/test_xsk.h   | 7 -------
 tools/testing/selftests/bpf/xskxceiver.c | 9 +++++++++
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/tools/testing/selftests/bpf/test_xsk.h 
b/tools/testing/selftests/bpf/test_xsk.h
index 
f4e192264b140c21cc861192fd0df991c46afd24..b068b25ea5da728fad1e17b894d6a1b1c9794f74
 100644
--- a/tools/testing/selftests/bpf/test_xsk.h
+++ b/tools/testing/selftests/bpf/test_xsk.h
@@ -34,13 +34,6 @@
 extern bool opt_verbose;
 #define print_verbose(x...) do { if (opt_verbose) ksft_print_msg(x); } while 
(0)
 
-static void __exit_with_error(int error, const char *file, const char *func, 
int line)
-{
-       ksft_test_result_fail("[%s:%s:%i]: ERROR: %d/\"%s\"\n", file, func, 
line, error,
-                             strerror(error));
-       ksft_exit_xfail();
-}
-#define exit_with_error(error) __exit_with_error(error, __FILE__, __func__, 
__LINE__)
 
 static inline u32 ceil_u32(u32 a, u32 b)
 {
diff --git a/tools/testing/selftests/bpf/xskxceiver.c 
b/tools/testing/selftests/bpf/xskxceiver.c
index 
20ae62b7014427929e55e10b274757a95897ff1e..68aa3317dfc62cd4deac07f2d58fefd55770775f
 100644
--- a/tools/testing/selftests/bpf/xskxceiver.c
+++ b/tools/testing/selftests/bpf/xskxceiver.c
@@ -107,6 +107,15 @@ static u32 opt_run_test = RUN_ALL_TESTS;
 
 void test__fail(void) { /* for network_helpers.c */ }
 
+static void __exit_with_error(int error, const char *file, const char *func, 
int line)
+{
+       ksft_test_result_fail("[%s:%s:%i]: ERROR: %d/\"%s\"\n", file, func, 
line,
+                             error, strerror(error));
+       ksft_exit_xfail();
+}
+
+#define exit_with_error(error) __exit_with_error(error, __FILE__, __func__, 
__LINE__)
+
 static bool ifobj_zc_avail(struct ifobject *ifobject)
 {
        size_t umem_sz = DEFAULT_UMEM_BUFFERS * XSK_UMEM__DEFAULT_FRAME_SIZE;

-- 
2.50.1


Reply via email to