Skip to content

Commit 294a7f1

Browse files
ihashuahkh
authored andcommitted
lib: kunit: Fix compilation test when using TEST_BIT_FIELD_COMPILE
A build condition was missing around a compilation test, this compilation test comes from the original test_bitfield code. And removed unnecessary code for this test. Fixes: d2585f5 ("lib: kunit: add bitfield test conversion to KUnit") Reported-by: Stephen Rothwell <[email protected]> Signed-off-by: Vitor Massaru Iha <[email protected]> Link: https://lore.kernel.org/linux-next/[email protected]/ Reviewed-by: Brendan Higgins <[email protected]> Signed-off-by: Shuah Khan <[email protected]>
1 parent d2585f5 commit 294a7f1

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

lib/bitfield_kunit.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ static void __init test_bitfields_variables(struct kunit *context)
125125
CHECK(u64, 0x0000001f8000000ull);
126126
}
127127

128-
128+
#ifdef TEST_BITFIELD_COMPILE
129129
static void __init test_bitfields_compile(struct kunit *context)
130130
{
131131
/* these should fail compilation */
@@ -135,13 +135,11 @@ static void __init test_bitfields_compile(struct kunit *context)
135135
/* this should at least give a warning */
136136
u16_encode_bits(0, 0x60000);
137137
}
138+
#endif
138139

139140
static struct kunit_case __refdata bitfields_test_cases[] = {
140141
KUNIT_CASE(test_bitfields_constants),
141142
KUNIT_CASE(test_bitfields_variables),
142-
#ifdef TEST_BITFIELD_COMPILE
143-
KUNIT_CASE(test_bitfields_compile),
144-
#endif
145143
{}
146144
};
147145

0 commit comments

Comments
 (0)