Skip to content

Commit b6e21b7

Browse files
tobluxakpm00
authored andcommitted
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/[email protected] Signed-off-by: Thorsten Blum <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 9a42bfd commit b6e21b7

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

lib/checksum_kunit.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -468,12 +468,9 @@ static __wsum to_wsum(u32 x)
468468

469469
static void assert_setup_correct(struct kunit *test)
470470
{
471-
CHECK_EQ(sizeof(random_buf) / sizeof(random_buf[0]), MAX_LEN);
472-
CHECK_EQ(sizeof(expected_results) / sizeof(expected_results[0]),
473-
MAX_LEN);
474-
CHECK_EQ(sizeof(init_sums_no_overflow) /
475-
sizeof(init_sums_no_overflow[0]),
476-
MAX_LEN);
471+
CHECK_EQ(ARRAY_SIZE(random_buf), MAX_LEN);
472+
CHECK_EQ(ARRAY_SIZE(expected_results), MAX_LEN);
473+
CHECK_EQ(ARRAY_SIZE(init_sums_no_overflow), MAX_LEN);
477474
}
478475

479476
/*

0 commit comments

Comments
 (0)