summaryrefslogtreecommitdiffstats
path: root/lib/kunit/test.c
diff options
context:
space:
mode:
authorRichard Fitzgerald <rf@opensource.cirrus.com>2023-08-28 11:41:08 +0100
committerShuah Khan <skhan@linuxfoundation.org>2023-09-18 10:45:40 -0600
commita3fdf784780ccb0008d630e8722d1389c49c7499 (patch)
tree8b356f74766cccf4d297d5da54180d7d94c10961 /lib/kunit/test.c
parent20631e154c78f4140fffe111f5c79464fae3c38c (diff)
downloadlinux-a3fdf784780ccb0008d630e8722d1389c49c7499.tar.gz
linux-a3fdf784780ccb0008d630e8722d1389c49c7499.tar.bz2
linux-a3fdf784780ccb0008d630e8722d1389c49c7499.zip
kunit: string-stream: Decouple string_stream from kunit
Re-work string_stream so that it is not tied to a struct kunit. This is to allow using it for the log of struct kunit_suite. Instead of resource-managing individual allocations the whole string_stream can be resource-managed, if required. alloc_string_stream() now allocates a string stream that is not resource-managed. string_stream_destroy() now works on an unmanaged string_stream allocated by alloc_string_stream() and frees the entire string_stream (previously it only freed the fragments). string_stream_clear() has been made public for callers that want to free the fragments without destroying the string_stream. For resource-managed allocations use kunit_alloc_string_stream() and kunit_free_string_stream(). In addition to this, string_stream_get_string() now returns an unmanaged buffer that the caller must kfree(). Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Reviewed-by: David Gow <davidgow@google.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Diffstat (limited to 'lib/kunit/test.c')
-rw-r--r--lib/kunit/test.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/kunit/test.c b/lib/kunit/test.c
index 30807694c459..bd1ef86fcd71 100644
--- a/lib/kunit/test.c
+++ b/lib/kunit/test.c
@@ -296,7 +296,7 @@ static void kunit_print_string_stream(struct kunit *test,
kunit_err(test, "\n");
} else {
kunit_err(test, "%s", buf);
- kunit_kfree(test, buf);
+ kfree(buf);
}
}