[PATCH] lib: checksum: Use ARRAY_SIZE() to improve assert_setup_correct()
From: Thorsten Blum
Date: Fri Jul 26 2024 - 11:50:07 EST
Use ARRAY_SIZE() to simplify the assert_setup_correct() function and
improve its readability.
Signed-off-by: Thorsten Blum <thorsten.blum@xxxxxxxxxx>
---
lib/checksum_kunit.c | 9 +++------
1 file 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);
}
/*
--
2.39.2