Skip to content

Commit

Permalink
lib: checksum: use ARRAY_SIZE() to improve assert_setup_correct()
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
toblux authored and akpm00 committed Sep 2, 2024
1 parent 9a42bfd commit b6e21b7
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions lib/checksum_kunit.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/*
Expand Down

0 comments on commit b6e21b7

Please sign in to comment.