diff options
author | David Gow <davidgow@google.com> | 2022-07-22 19:15:30 +0200 |
---|---|---|
committer | Shuah Khan <skhan@linuxfoundation.org> | 2022-10-07 18:15:22 +0200 |
commit | 78b1c6584fcedcf2d9687a4455c461859094cf04 (patch) | |
tree | f55834f324f16c9854f1750ab49567d5ee685072 /lib/kunit/string-stream.h | |
parent | Documentation: Kunit: Use full path to .kunitconfig (diff) | |
download | linux-78b1c6584fcedcf2d9687a4455c461859094cf04.tar.xz linux-78b1c6584fcedcf2d9687a4455c461859094cf04.zip |
kunit: string-stream: Simplify resource use
Currently, KUnit's string streams are themselves "KUnit resources".
This is redundant since the stream itself is already allocated with
kunit_kzalloc() and will thus be freed automatically at the end of the
test.
string-stream is only used internally within KUnit, and isn't using the
extra features that resources provide like reference counting, being
able to locate them dynamically as "test-local variables", etc.
Indeed, the resource's refcount is never incremented when the
pointer is returned. The fact that it's always manually destroyed is
more evidence that the reference counting is unused.
Signed-off-by: David Gow <davidgow@google.com>
Signed-off-by: Daniel Latypov <dlatypov@google.com>
Reviewed-by: Brendan Higgins <brendanhiggins@google.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Diffstat (limited to 'lib/kunit/string-stream.h')
-rw-r--r-- | lib/kunit/string-stream.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/kunit/string-stream.h b/lib/kunit/string-stream.h index 43f9508a55b4..494dee0f24bd 100644 --- a/lib/kunit/string-stream.h +++ b/lib/kunit/string-stream.h @@ -46,6 +46,6 @@ int string_stream_append(struct string_stream *stream, bool string_stream_is_empty(struct string_stream *stream); -int string_stream_destroy(struct string_stream *stream); +void string_stream_destroy(struct string_stream *stream); #endif /* _KUNIT_STRING_STREAM_H */ |