summaryrefslogtreecommitdiffstats
path: root/lib/kunit
diff options
context:
space:
mode:
authorKuan-Wei Chiu <visitorckw@gmail.com>2024-11-14 17:55:58 +0100
committerShuah Khan <skhan@linuxfoundation.org>2024-11-19 23:18:13 +0100
commit95b6d723a00710f129b81556c93fdd994c105ab1 (patch)
treeb007cb90e22e593be7f03e34b38c24a4dcd5db38 /lib/kunit
parentkunit: Fix potential null dereference in kunit_device_driver_test() (diff)
downloadlinux-95b6d723a00710f129b81556c93fdd994c105ab1.tar.xz
linux-95b6d723a00710f129b81556c93fdd994c105ab1.zip
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>
Diffstat (limited to 'lib/kunit')
-rw-r--r--lib/kunit/debugfs.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/kunit/debugfs.c b/lib/kunit/debugfs.c
index b25d214b93e1..af71911f4a07 100644
--- a/lib/kunit/debugfs.c
+++ b/lib/kunit/debugfs.c
@@ -181,7 +181,7 @@ void kunit_debugfs_create_suite(struct kunit_suite *suite)
* successfully.
*/
stream = alloc_string_stream(GFP_KERNEL);
- if (IS_ERR_OR_NULL(stream))
+ if (IS_ERR(stream))
return;
string_stream_set_append_newlines(stream, true);
@@ -189,7 +189,7 @@ void kunit_debugfs_create_suite(struct kunit_suite *suite)
kunit_suite_for_each_test_case(suite, test_case) {
stream = alloc_string_stream(GFP_KERNEL);
- if (IS_ERR_OR_NULL(stream))
+ if (IS_ERR(stream))
goto err;
string_stream_set_append_newlines(stream, true);