From: Zenghui Yu <zenghui.yu@linux.dev>
To: linux-mm@kvack.org, linux-kselftest@vger.kernel.org,
linux-kernel@vger.kernel.org
Cc: akpm@linux-foundation.org, david@kernel.org, ljs@kernel.org,
liam@infradead.org, vbabka@kernel.org, rppt@kernel.org,
surenb@google.com, mhocko@suse.com, shuah@kernel.org,
ziy@nvidia.com, baolin.wang@linux.alibaba.com,
nico.pache@linux.dev, ryan.roberts@arm.com, dev.jain@arm.com,
baohua@kernel.org, lance.yang@linux.dev, usama.arif@linux.dev,
"Zenghui Yu (Huawei)" <zenghui.yu@linux.dev>
Subject: [PATCH] selftests/mm: remove unreachable returns after ksft exit helpers
Date: Thu, 3 Sep 2026 21:52:51 +0800 [thread overview]
Message-ID: <20260903135251.39593-1-zenghui.yu@linux.dev> (raw)
From: "Zenghui Yu (Huawei)" <zenghui.yu@linux.dev>
The ksft_exit*() helpers such as ksft_exit_fail_msg() are declared
__noreturn, and the ksft_exit() and ksft_finished() macros expand to calls
of them, always terminating the process via exit(). Any return statements
following such calls are unreachable, both at the end of main() and on
error paths of helper functions.
Remove all of them. No functional change.
Assisted-by: GLM-5.3 OpenCode
Signed-off-by: Zenghui Yu (Huawei) <zenghui.yu@linux.dev>
---
tools/testing/selftests/mm/folio_split_race_test.c | 2 --
tools/testing/selftests/mm/mlock-random-test.c | 1 -
tools/testing/selftests/mm/pkey_sighandler_tests.c | 1 -
tools/testing/selftests/mm/split_huge_page_test.c | 4 ----
4 files changed, 8 deletions(-)
diff --git a/tools/testing/selftests/mm/folio_split_race_test.c b/tools/testing/selftests/mm/folio_split_race_test.c
index 45b84f7b364e..1960635a953e 100644
--- a/tools/testing/selftests/mm/folio_split_race_test.c
+++ b/tools/testing/selftests/mm/folio_split_race_test.c
@@ -269,6 +269,4 @@ int main(void)
NUM_ITERATIONS);
ksft_exit(iter == NUM_ITERATIONS);
-
- return 0;
}
diff --git a/tools/testing/selftests/mm/mlock-random-test.c b/tools/testing/selftests/mm/mlock-random-test.c
index 16294bc7dae6..58772914fd79 100644
--- a/tools/testing/selftests/mm/mlock-random-test.c
+++ b/tools/testing/selftests/mm/mlock-random-test.c
@@ -71,7 +71,6 @@ int get_proc_locked_vm_size(void)
fclose(f);
ksft_exit_fail_msg("cannot parse VmLck in /proc/self/status: %s\n", strerror(errno));
- return -1;
}
/*
diff --git a/tools/testing/selftests/mm/pkey_sighandler_tests.c b/tools/testing/selftests/mm/pkey_sighandler_tests.c
index 74bf79a5399d..f9c728ba96a5 100644
--- a/tools/testing/selftests/mm/pkey_sighandler_tests.c
+++ b/tools/testing/selftests/mm/pkey_sighandler_tests.c
@@ -556,5 +556,4 @@ int main(int argc, char *argv[])
}
ksft_finished();
- return 0;
}
diff --git a/tools/testing/selftests/mm/split_huge_page_test.c b/tools/testing/selftests/mm/split_huge_page_test.c
index 86a603692826..c01d227d7fd6 100644
--- a/tools/testing/selftests/mm/split_huge_page_test.c
+++ b/tools/testing/selftests/mm/split_huge_page_test.c
@@ -101,7 +101,6 @@ static bool is_backed_by_folio(char *vaddr, int order, int pagemap_fd,
return (pfn_flags & folio_tail_flags) != folio_tail_flags;
fail:
ksft_exit_fail_msg("Failed to get folio info\n");
- return false;
}
static int check_after_split_folio_orders(char *vaddr_start, size_t len,
@@ -548,7 +547,6 @@ static int create_pagecache_thp_and_fd(const char *testfile, size_t fd_size,
err_out_unlink:
unlink(testfile);
ksft_exit_fail_msg("Failed to create large pagecache folios\n");
- return -1;
}
static void split_thp_in_pagecache_to_order_at(size_t fd_size,
@@ -711,6 +709,4 @@ int main(int argc, char **argv)
free(expected_orders);
ksft_finished();
-
- return 0;
}
--
2.53.0
next reply other threads:[~2026-09-03 13:53 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-03 13:52 Zenghui Yu [this message]
2026-09-03 14:04 ` [PATCH] selftests/mm: remove unreachable returns after ksft exit helpers Lorenzo Stoakes (ARM)
2026-09-04 0:44 ` SJ Park
2026-09-04 1:33 ` Zi Yan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260903135251.39593-1-zenghui.yu@linux.dev \
--to=zenghui.yu@linux.dev \
--cc=akpm@linux-foundation.org \
--cc=baohua@kernel.org \
--cc=baolin.wang@linux.alibaba.com \
--cc=david@kernel.org \
--cc=dev.jain@arm.com \
--cc=lance.yang@linux.dev \
--cc=liam@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ljs@kernel.org \
--cc=mhocko@suse.com \
--cc=nico.pache@linux.dev \
--cc=rppt@kernel.org \
--cc=ryan.roberts@arm.com \
--cc=shuah@kernel.org \
--cc=surenb@google.com \
--cc=usama.arif@linux.dev \
--cc=vbabka@kernel.org \
--cc=ziy@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox