Skip to content

Commit

Permalink
kunit: string-stream-test: use KUNIT_DEFINE_ACTION_WRAPPER
Browse files Browse the repository at this point in the history
Use KUNIT_DEFINE_ACTION_WRAPPER macro to define the 'kfree' and
'string_stream_destroy' wrappers for kunit_add_action.

Signed-off-by: Ivan Orlov <[email protected]>
Reviewed-by: Rae Moar <[email protected]>
Acked-by: David Gow <[email protected]>
Signed-off-by: Shuah Khan <[email protected]>
  • Loading branch information
ivanorlov2206 authored and shuahkh committed May 6, 2024
1 parent 4b513a0 commit a96a394
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions lib/kunit/string-stream-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down

0 comments on commit a96a394

Please sign in to comment.