The list_entry_is_head() macro was added[1] after the list KUnit tests, so wasn't tested. Add a new KUnit test to complete the set. [1]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=e130816164e244b692921de49771eeb28205152d Signed-off-by: David Gow <davidgow@xxxxxxxxxx> --- lib/list-test.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib/list-test.c b/lib/list-test.c index 7ce7eaebe060..4cd06a9fc73c 100644 --- a/lib/list-test.c +++ b/lib/list-test.c @@ -538,6 +538,18 @@ static void list_test_list_entry(struct kunit *test) struct list_test_struct, list)); } +static void list_test_list_entry_is_head(struct kunit *test) +{ + struct list_test_struct test_struct1, test_struct2; + LIST_HEAD(list); + + list_add_tail(&test_struct1.list, &list); + list_add_tail(&test_struct2.list, &list); + + KUNIT_EXPECT_FALSE(test, list_entry_is_head((&test_struct1), &list, list)); + KUNIT_EXPECT_FALSE(test, list_entry_is_head((&test_struct2), &list, list)); +} + static void list_test_list_first_entry(struct kunit *test) { struct list_test_struct test_struct1, test_struct2; @@ -753,6 +765,7 @@ static struct kunit_case list_test_cases[] = { KUNIT_CASE(list_test_list_splice_init), KUNIT_CASE(list_test_list_splice_tail_init), KUNIT_CASE(list_test_list_entry), + KUNIT_CASE(list_test_list_entry_is_head), KUNIT_CASE(list_test_list_first_entry), KUNIT_CASE(list_test_list_last_entry), KUNIT_CASE(list_test_list_first_entry_or_null), -- 2.35.0.263.gb82422642f-goog