aboutsummaryrefslogtreecommitdiff
path: root/lib/checksum_kunit.c
diff options
context:
space:
mode:
authorThorsten Blum <thorsten.blum@toblux.com>2024-07-26 17:49:46 +0200
committerAndrew Morton <akpm@linux-foundation.org>2024-09-01 20:43:30 -0700
commitb6e21b71208f289a796d786bd695ec25eae4ed9a (patch)
treedc235db316582280136d583b4f409794495aa096 /lib/checksum_kunit.c
parent9a42bfd255b288dad2d1a9df0a1fe58394d5da12 (diff)
lib: checksum: use ARRAY_SIZE() to improve assert_setup_correct()
Use ARRAY_SIZE() to simplify the assert_setup_correct() function and improve its readability. Link: https://lkml.kernel.org/r/20240726154946.230928-1-thorsten.blum@toblux.com Signed-off-by: Thorsten Blum <thorsten.blum@toblux.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'lib/checksum_kunit.c')
-rw-r--r--lib/checksum_kunit.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/lib/checksum_kunit.c b/lib/checksum_kunit.c
index 4e4d081a1d3b..be04aa42125c 100644
--- a/lib/checksum_kunit.c
+++ b/lib/checksum_kunit.c
@@ -468,12 +468,9 @@ static __wsum to_wsum(u32 x)
static void assert_setup_correct(struct kunit *test)
{
- CHECK_EQ(sizeof(random_buf) / sizeof(random_buf[0]), MAX_LEN);
- CHECK_EQ(sizeof(expected_results) / sizeof(expected_results[0]),
- MAX_LEN);
- CHECK_EQ(sizeof(init_sums_no_overflow) /
- sizeof(init_sums_no_overflow[0]),
- MAX_LEN);
+ CHECK_EQ(ARRAY_SIZE(random_buf), MAX_LEN);
+ CHECK_EQ(ARRAY_SIZE(expected_results), MAX_LEN);
+ CHECK_EQ(ARRAY_SIZE(init_sums_no_overflow), MAX_LEN);
}
/*