From: Dan Carpenter Date: Wed, 10 Jan 2024 18:55:22 +0000 (+0300) Subject: kunit: Fix a NULL vs IS_ERR() bug X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=ed1a72fb0d646c983c85b62144fb1d134a8edb71;p=linux.git 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 Reviewed-by: Rae Moar Reviewed-by: David Gow Signed-off-by: Shuah Khan --- diff --git a/lib/kunit/kunit-test.c b/lib/kunit/kunit-test.c index c4259d910356b..f7980ef236a38 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);