From c90fba60f274b182f8b4df0f5a5dd23a2457f4a3 Mon Sep 17 00:00:00 2001 From: Ilpo Järvinen Date: Fri, 15 Dec 2023 17:04:48 +0200 Subject: selftests/resctrl: Return -1 instead of errno on error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A number of functions in the resctrl selftests return errno. It is problematic because errno is positive which is often counterintuitive. Also, every site returning errno prints the error message already with ksft_perror() so there is not much added value in returning the precise error code. Simply convert all places returning errno to return -1 that is typical userspace error code in case of failures. While at it, improve resctrl_val() comment to state that 0 means the test was run (either pass or fail). Signed-off-by: Ilpo Järvinen Reviewed-by: Reinette Chatre Signed-off-by: Shuah Khan --- tools/testing/selftests/resctrl/mbm_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tools/testing/selftests/resctrl/mbm_test.c') diff --git a/tools/testing/selftests/resctrl/mbm_test.c b/tools/testing/selftests/resctrl/mbm_test.c index 045cd7818c79..721b3ecbc158 100644 --- a/tools/testing/selftests/resctrl/mbm_test.c +++ b/tools/testing/selftests/resctrl/mbm_test.c @@ -61,7 +61,7 @@ static int check_results(size_t span) if (!fp) { ksft_perror(output); - return errno; + return -1; } runs = 0; -- cgit