Skip to content

Commit a96a394

Browse files
ivanorlov2206shuahkh
authored andcommitted
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>
1 parent 4b513a0 commit a96a394

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

lib/kunit/string-stream-test.c

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,10 @@ struct string_stream_test_priv {
2222
};
2323

2424
/* Avoids a cast warning if kfree() is passed direct to kunit_add_action(). */
25-
static void kfree_wrapper(void *p)
26-
{
27-
kfree(p);
28-
}
25+
KUNIT_DEFINE_ACTION_WRAPPER(kfree_wrapper, kfree, const void *);
2926

3027
/* Avoids a cast warning if string_stream_destroy() is passed direct to kunit_add_action(). */
31-
static void cleanup_raw_stream(void *p)
32-
{
33-
struct string_stream *stream = p;
34-
35-
string_stream_destroy(stream);
36-
}
28+
KUNIT_DEFINE_ACTION_WRAPPER(cleanup_raw_stream, string_stream_destroy, struct string_stream *);
3729

3830
static char *get_concatenated_string(struct kunit *test, struct string_stream *stream)
3931
{

0 commit comments

Comments
 (0)