Skip to content

Commit ed1a72f

Browse files
Dan Carpentershuahkh
authored andcommitted
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: d03c720 ("kunit: Add APIs for managing devices") Signed-off-by: Dan Carpenter <[email protected]> Reviewed-by: Rae Moar <[email protected]> Reviewed-by: David Gow <[email protected]> Signed-off-by: Shuah Khan <[email protected]>
1 parent 6613476 commit ed1a72f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/kunit/kunit-test.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -720,7 +720,7 @@ static void kunit_device_cleanup_test(struct kunit *test)
720720
long action_was_run = 0;
721721

722722
test_device = kunit_device_register(test, "my_device");
723-
KUNIT_ASSERT_NOT_NULL(test, test_device);
723+
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, test_device);
724724

725725
/* Add an action to verify cleanup. */
726726
devm_add_action(test_device, test_dev_action, &action_was_run);

0 commit comments

Comments
 (0)