]> git.baikalelectronics.ru Git - kernel.git/commit
thunderbolt: test: split up test cases in tb_test_credit_alloc_all
authorLinus Torvalds <torvalds@linux-foundation.org>
Mon, 6 Sep 2021 19:27:03 +0000 (12:27 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 6 Sep 2021 19:27:03 +0000 (12:27 -0700)
commit9a6833435251661f8411b6b0479b6ab973ac0243
tree8ab08529d0db6df5efaa260d6079583746f4d313
parentb6f6ef87acd5ae1f9749696830232342576921be
thunderbolt: test: split up test cases in tb_test_credit_alloc_all

The tb_test_credit_alloc_all() function had a huge number of
KUNIT_ASSERT() statements, all of which (though the magic of many many
layers of inscrutable macros) ended up allocating and initializing
various test assertion structures on the stack.

Don't do that.  The kernel stack isn't infinite, and we have compiler
warnings (now errors) for the case where a stack frame grows too large.

Like it did here, by not an inconsiderable margin:

   drivers/thunderbolt/test.c: In function ‘tb_test_credit_alloc_all’:
   drivers/thunderbolt/test.c:2367:1: error: the frame size of 4500 bytes is larger than 2048 bytes [-Werror=frame-larger-than=]
    2367 | }
         | ^

Solve this similarly to the lib/test_scanf case: split out the tests
into several smaller functions, each just testing one particular tunnel
credit allocation.

This makes the i386 allyesconfig build work for me again.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/thunderbolt/test.c