Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Thorsten Blum and committed by
Andrew Morton
b6e21b71 9a42bfd2

+3 -6
+3 -6
lib/checksum_kunit.c
··· 468 468 469 469 static void assert_setup_correct(struct kunit *test) 470 470 { 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); 477 474 } 478 475 479 476 /*