diff options
author | Dan Carpenter <dan.carpenter@linaro.org> | 2024-01-10 21:55:22 +0300 |
---|---|---|
committer | Shuah Khan <skhan@linuxfoundation.org> | 2024-01-22 17:58:12 +0300 |
commit | ed1a72fb0d646c983c85b62144fb1d134a8edb71 (patch) | |
tree | 01f1a2cef2f96b37b8e1b576cd0cd05b4b2cb5f2 /lib/kunit | |
parent | 6613476e225e090cc9aad49be7fa504e290dd33d (diff) | |
download | linux-ed1a72fb0d646c983c85b62144fb1d134a8edb71.tar.xz |
kunit: Fix a NULL vs IS_ERR() bug
The kunit_device_register() function doesn't return NULL, it returns
error pointers. Change the KUNIT_ASSERT_NOT_NULL() to check for
ERR_OR_NULL().
Fixes: d03c720e03bd ("kunit: Add APIs for managing devices")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Rae Moar <rmoar@google.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/kunit-test.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/kunit/kunit-test.c b/lib/kunit/kunit-test.c index c4259d910356..f7980ef236a3 100644 --- a/lib/kunit/kunit-test.c +++ b/lib/kunit/kunit-test.c @@ -720,7 +720,7 @@ static void kunit_device_cleanup_test(struct kunit *test) long action_was_run = 0; test_device = kunit_device_register(test, "my_device"); - KUNIT_ASSERT_NOT_NULL(test, test_device); + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, test_device); /* Add an action to verify cleanup. */ devm_add_action(test_device, test_dev_action, &action_was_run); |