Skip to content

Commit

Permalink
Merge tag 'linux-kselftest-kunit-fixes-6.1-rc3' of git://git.kernel.o…
Browse files Browse the repository at this point in the history
…rg/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
  • Loading branch information
Linus Torvalds committed Oct 24, 2022
2 parents 21c9249 + 6188877 commit 2a91e89
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/kunit/string-stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ int string_stream_vadd(struct string_stream *stream,
frag_container = alloc_string_stream_fragment(stream->test,
len,
stream->gfp);
if (!frag_container)
return -ENOMEM;
if (IS_ERR(frag_container))
return PTR_ERR(frag_container);

len = vsnprintf(frag_container->fragment, len, fmt, args);
spin_lock(&stream->lock);
Expand Down
2 changes: 1 addition & 1 deletion lib/kunit/test.c
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ static void kunit_fail(struct kunit *test, const struct kunit_loc *loc,
kunit_set_failure(test);

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

0 comments on commit 2a91e89

Please sign in to comment.