kunit: kmalloc_array: Use kunit_add_action()
authorDavid Gow <davidgow@google.com>
Thu, 25 May 2023 04:21:30 +0000 (12:21 +0800)
committerShuah Khan <skhan@linuxfoundation.org>
Thu, 25 May 2023 14:53:07 +0000 (08:53 -0600)
commit57e3cded99e9c840bc5310878d0a7f4e7768a296
treeb6ebb8c7d1f421a849499664268b44f9e4732533
parent00e63f8afcfc6bf93d75141c51d35e8a40e86363
kunit: kmalloc_array: Use kunit_add_action()

The kunit_add_action() function is much simpler and cleaner to use that
the full KUnit resource API for simple things like the
kunit_kmalloc_array() functionality.

Replacing it allows us to get rid of a number of helper functions, and
leaves us with no uses of kunit_alloc_resource(), which has some
usability problems and is going to have its behaviour modified in an
upcoming patch.

Note that we need to use kunit_defer_trigger_all() to implement
kunit_kfree().

Reviewed-by: Benjamin Berg <benjamin.berg@intel.com>
Reviewed-by: Maxime Ripard <maxime@cerno.tech>
Tested-by: Maxime Ripard <maxime@cerno.tech>
Signed-off-by: David Gow <davidgow@google.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
include/kunit/test.h
lib/kunit/test.c