Skip to content

Commit 95b6d72

Browse files
visitorckwshuahkh
authored andcommitted
kunit: debugfs: Use IS_ERR() for alloc_string_stream() error check
The alloc_string_stream() function only returns ERR_PTR(-ENOMEM) on failure and never returns NULL. Therefore, switching the error check in the caller from IS_ERR_OR_NULL to IS_ERR improves clarity, indicating that this function will return an error pointer (not NULL) when an error occurs. This change avoids any ambiguity regarding the function's return behavior. Link: https://lore.kernel.org/lkml/Zy9deU5VK3YR+r9N@visitorckw-System-Product-Name Signed-off-by: Kuan-Wei Chiu <visitorckw@gmail.com> Reviewed-by: David Gow <davidgow@google.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
1 parent 435c20e commit 95b6d72

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/kunit/debugfs.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,15 +181,15 @@ void kunit_debugfs_create_suite(struct kunit_suite *suite)
181181
* successfully.
182182
*/
183183
stream = alloc_string_stream(GFP_KERNEL);
184-
if (IS_ERR_OR_NULL(stream))
184+
if (IS_ERR(stream))
185185
return;
186186

187187
string_stream_set_append_newlines(stream, true);
188188
suite->log = stream;
189189

190190
kunit_suite_for_each_test_case(suite, test_case) {
191191
stream = alloc_string_stream(GFP_KERNEL);
192-
if (IS_ERR_OR_NULL(stream))
192+
if (IS_ERR(stream))
193193
goto err;
194194

195195
string_stream_set_append_newlines(stream, true);

0 commit comments

Comments
 (0)