kunit: use NULL macros
authorRicardo Ribalda <ribalda@chromium.org>
Fri, 11 Feb 2022 16:42:42 +0000 (17:42 +0100)
committerShuah Khan <skhan@linuxfoundation.org>
Mon, 4 Apr 2022 20:29:08 +0000 (14:29 -0600)
Replace the NULL checks with the more specific and idiomatic NULL macros.

Reviewed-by: Brendan Higgins <brendanhiggins@google.com>
Reviewed-by: Daniel Latypov <dlatypov@google.com>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
lib/kunit/kunit-example-test.c
lib/kunit/kunit-test.c

index 4bbf37c04ebaf0c50bc19693f4a37c1637976bee..91b1df7f59edd34e575793975fdf2d60d1bfff57 100644 (file)
@@ -91,6 +91,8 @@ static void example_all_expect_macros_test(struct kunit *test)
        KUNIT_EXPECT_NOT_ERR_OR_NULL(test, test);
        KUNIT_EXPECT_PTR_EQ(test, NULL, NULL);
        KUNIT_EXPECT_PTR_NE(test, test, NULL);
+       KUNIT_EXPECT_NULL(test, NULL);
+       KUNIT_EXPECT_NOT_NULL(test, test);
 
        /* String assertions */
        KUNIT_EXPECT_STREQ(test, "hi", "hi");
index 555601d17f7956283ac8cb7b865bd4babd90f348..8e2fe083a54956b7fedad7aef8a84e03171c1b3e 100644 (file)
@@ -435,7 +435,7 @@ static void kunit_log_test(struct kunit *test)
        KUNIT_EXPECT_NOT_ERR_OR_NULL(test,
                                     strstr(suite.log, "along with this."));
 #else
-       KUNIT_EXPECT_PTR_EQ(test, test->log, (char *)NULL);
+       KUNIT_EXPECT_NULL(test, test->log);
 #endif
 }