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: 78b1c6584f
("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>
This commit is contained in:
parent
9abf2313ad
commit
618887768b
@ -56,8 +56,8 @@ int string_stream_vadd(struct string_stream *stream,
|
|||||||
frag_container = alloc_string_stream_fragment(stream->test,
|
frag_container = alloc_string_stream_fragment(stream->test,
|
||||||
len,
|
len,
|
||||||
stream->gfp);
|
stream->gfp);
|
||||||
if (!frag_container)
|
if (IS_ERR(frag_container))
|
||||||
return -ENOMEM;
|
return PTR_ERR(frag_container);
|
||||||
|
|
||||||
len = vsnprintf(frag_container->fragment, len, fmt, args);
|
len = vsnprintf(frag_container->fragment, len, fmt, args);
|
||||||
spin_lock(&stream->lock);
|
spin_lock(&stream->lock);
|
||||||
|
@ -265,7 +265,7 @@ static void kunit_fail(struct kunit *test, const struct kunit_loc *loc,
|
|||||||
kunit_set_failure(test);
|
kunit_set_failure(test);
|
||||||
|
|
||||||
stream = alloc_string_stream(test, GFP_KERNEL);
|
stream = alloc_string_stream(test, GFP_KERNEL);
|
||||||
if (!stream) {
|
if (IS_ERR(stream)) {
|
||||||
WARN(true,
|
WARN(true,
|
||||||
"Could not allocate stream to print failed assertion in %s:%d\n",
|
"Could not allocate stream to print failed assertion in %s:%d\n",
|
||||||
loc->file,
|
loc->file,
|
||||||
|
Loading…
Reference in New Issue
Block a user