Skip to content

Commit 2a91e89

Browse files
committed
Merge tag 'linux-kselftest-kunit-fixes-6.1-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest
Pull KUnit fixes from Shuah Khan: "One single fix to update alloc_string_stream() callers to check for IS_ERR() instead of NULL to be in sync with alloc_string_stream() returning an ERR_PTR()" * tag 'linux-kselftest-kunit-fixes-6.1-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest: kunit: update NULL vs IS_ERR() tests
2 parents 21c9249 + 6188877 commit 2a91e89

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/kunit/string-stream.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ int string_stream_vadd(struct string_stream *stream,
5656
frag_container = alloc_string_stream_fragment(stream->test,
5757
len,
5858
stream->gfp);
59-
if (!frag_container)
60-
return -ENOMEM;
59+
if (IS_ERR(frag_container))
60+
return PTR_ERR(frag_container);
6161

6262
len = vsnprintf(frag_container->fragment, len, fmt, args);
6363
spin_lock(&stream->lock);

lib/kunit/test.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ static void kunit_fail(struct kunit *test, const struct kunit_loc *loc,
265265
kunit_set_failure(test);
266266

267267
stream = alloc_string_stream(test, GFP_KERNEL);
268-
if (!stream) {
268+
if (IS_ERR(stream)) {
269269
WARN(true,
270270
"Could not allocate stream to print failed assertion in %s:%d\n",
271271
loc->file,

0 commit comments

Comments
 (0)