aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGravatar Ivan Orlov <ivan.orlov0322@gmail.com> 2024-04-23 19:27:01 +0100
committerGravatar Shuah Khan <skhan@linuxfoundation.org> 2024-05-06 14:22:02 -0600
commita96a39457705018ad1aac79e7a8453ee52b512ba (patch)
tree7feb34ab3526af26b0daf48e284e726804a8ad98 /lib
parentkunit: test: Move fault tests behind KUNIT_FAULT_TEST Kconfig option (diff)
downloadlinux-a96a39457705018ad1aac79e7a8453ee52b512ba.tar.gz
linux-a96a39457705018ad1aac79e7a8453ee52b512ba.tar.bz2
linux-a96a39457705018ad1aac79e7a8453ee52b512ba.zip
kunit: string-stream-test: use KUNIT_DEFINE_ACTION_WRAPPER
Use KUNIT_DEFINE_ACTION_WRAPPER macro to define the 'kfree' and 'string_stream_destroy' wrappers for kunit_add_action. Signed-off-by: Ivan Orlov <ivan.orlov0322@gmail.com> Reviewed-by: Rae Moar <rmoar@google.com> Acked-by: David Gow <davidgow@google.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/kunit/string-stream-test.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/lib/kunit/string-stream-test.c b/lib/kunit/string-stream-test.c
index 03fb511826f7..7511442ea98f 100644
--- a/lib/kunit/string-stream-test.c
+++ b/lib/kunit/string-stream-test.c
@@ -22,18 +22,10 @@ struct string_stream_test_priv {
};
/* Avoids a cast warning if kfree() is passed direct to kunit_add_action(). */
-static void kfree_wrapper(void *p)
-{
- kfree(p);
-}
+KUNIT_DEFINE_ACTION_WRAPPER(kfree_wrapper, kfree, const void *);
/* Avoids a cast warning if string_stream_destroy() is passed direct to kunit_add_action(). */
-static void cleanup_raw_stream(void *p)
-{
- struct string_stream *stream = p;
-
- string_stream_destroy(stream);
-}
+KUNIT_DEFINE_ACTION_WRAPPER(cleanup_raw_stream, string_stream_destroy, struct string_stream *);
static char *get_concatenated_string(struct kunit *test, struct string_stream *stream)
{