Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

kunit: update NULL vs IS_ERR() tests

The alloc_string_stream() functions were changed from returning NULL on
error to returning error pointers so these caller needs to be updated
as well.

Fixes: 78b1c6584fce ("kunit: string-stream: Simplify resource use")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Daniel Latypov <dlatypov@google.com>
Reviewed-by: David Gow <davidgow@google.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>

authored by

Dan Carpenter and committed by
Shuah Khan
61888776 9abf2313

+3 -3
+2 -2
lib/kunit/string-stream.c
··· 56 56 frag_container = alloc_string_stream_fragment(stream->test, 57 57 len, 58 58 stream->gfp); 59 - if (!frag_container) 60 - return -ENOMEM; 59 + if (IS_ERR(frag_container)) 60 + return PTR_ERR(frag_container); 61 61 62 62 len = vsnprintf(frag_container->fragment, len, fmt, args); 63 63 spin_lock(&stream->lock);
+1 -1
lib/kunit/test.c
··· 265 265 kunit_set_failure(test); 266 266 267 267 stream = alloc_string_stream(test, GFP_KERNEL); 268 - if (!stream) { 268 + if (IS_ERR(stream)) { 269 269 WARN(true, 270 270 "Could not allocate stream to print failed assertion in %s:%d\n", 271 271 loc->file,