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>
This commit is contained in:
Ivan Orlov 2024-04-23 19:27:01 +01:00 committed by Shuah Khan
parent 4b513a02fd
commit a96a394577

View File

@ -22,18 +22,10 @@ struct string_stream_test_priv {
}; };
/* Avoids a cast warning if kfree() is passed direct to kunit_add_action(). */ /* Avoids a cast warning if kfree() is passed direct to kunit_add_action(). */
static void kfree_wrapper(void *p) KUNIT_DEFINE_ACTION_WRAPPER(kfree_wrapper, kfree, const void *);
{
kfree(p);
}
/* Avoids a cast warning if string_stream_destroy() is passed direct to kunit_add_action(). */ /* Avoids a cast warning if string_stream_destroy() is passed direct to kunit_add_action(). */
static void cleanup_raw_stream(void *p) KUNIT_DEFINE_ACTION_WRAPPER(cleanup_raw_stream, string_stream_destroy, struct string_stream *);
{
struct string_stream *stream = p;
string_stream_destroy(stream);
}
static char *get_concatenated_string(struct kunit *test, struct string_stream *stream) static char *get_concatenated_string(struct kunit *test, struct string_stream *stream)
{ {