net: mctp: usblib: Fix broken assertion

The expression in a static assertion in the kunit tests was not
considered constant by gcc, causing an error. Replace the static assert
with a runtime kunit equivalent.

Fixes: 1e12f734af ("net: mctp: usblib: Add initial kunit tx tests")
Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Closes: https://lore.kernel.org/netdev/CAMuHMdXTGGdGWZ9sKz5_sQF1237gV844cEhkXr6v_TUHPOb78Q@mail.gmail.com/
Signed-off-by: James Lee <james@codeconstruct.com.au>
Link: https://patch.msgid.link/20261026-dev-mctp-static-assert-fix-v1-1-ceef9913e891@codeconstruct.com.au
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
James Lee 2026-10-26 11:32:32 +08:00 committed by Jakub Kicinski
parent 4c6fbb1fba
commit 8146be0490

View File

@ -816,8 +816,8 @@ static void mctp_usblib_test_tx_multi_push(struct kunit *test)
};
int rc;
static_assert(!sends[ARRAY_SIZE(sends) - 1].more,
"The last push must claim there will be no more");
KUNIT_ASSERT_TRUE_MSG(test, !sends[ARRAY_SIZE(sends) - 1].more,
"The last push must claim there will be no more");
max_length = 0;
for (i = 0; i < ARRAY_SIZE(sends); i++) {