From patchwork Mon Feb 7 20:27:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 12737869 X-Patchwork-Delegate: brendanhiggins@google.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B5F44C433EF for ; Mon, 7 Feb 2022 20:30:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230473AbiBGU3w (ORCPT ); Mon, 7 Feb 2022 15:29:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50466 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242125AbiBGU1V (ORCPT ); Mon, 7 Feb 2022 15:27:21 -0500 Received: from mail-ed1-x533.google.com (mail-ed1-x533.google.com [IPv6:2a00:1450:4864:20::533]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 63A7CC0401E4 for ; Mon, 7 Feb 2022 12:27:18 -0800 (PST) Received: by mail-ed1-x533.google.com with SMTP id cz16so14424765edb.8 for ; Mon, 07 Feb 2022 12:27:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Y0o7uOOFR/F8wdFMHcK21ektAthAmrg4gw7mo/oxzd4=; b=W+jEhB6BQocffxsFNkW+QnIj1nMaeUqVvtmgY5zdnPDs+Nl9psIec7vViyEMf3K8eY AWEv/EFHjEuuMQtec0OsFSFAEEx748otMn9oQZ4FwkLpJrHKqLz4qMpEz8ccLJjAQnBq 4PLvMgxVzPRNB78doQxoaq4QwYt00S4K2U78A= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Y0o7uOOFR/F8wdFMHcK21ektAthAmrg4gw7mo/oxzd4=; b=PL3KyTokd6f47PYbVthxy3m5Wtpqey8wjdaXfx/4xQeTwzsa/xgWOW3u+2bVBPpVfh TsvyCux0ULiivIuQBt75xCik9zb4EbK71/j8LzCyZKn2zVpITbfBFmQT94V7ingzwhUQ cRssBG/kv7cU8Ctjwmh6ZyEpfaM9TeCKEymd+xCF05E7F22A9vaHNK5JXIFWndhFoL9+ LafuiSV3j7kQYCYPg9uD+FTDv+JIOhfthU1c3WSe8Y0kIjNCMi7plaaSGirb13JyuIaS tCyh/FkZOlRhd66bqPLUY6nzsznIklhiLF9D3xsR/gmGIQ1gwHQHr7VC0Aj4mtUUvZNe R0ig== X-Gm-Message-State: AOAM531ffBcRKd1y+0sOm1fRdMjSvxokpjEtcvuXtCoruMN/iQ34Iwow pa1rGcU0qqddgdugSUuTJMnezA== X-Google-Smtp-Source: ABdhPJwZ01sfMnma+G/owZbNQQ6Vbx9u1iDGad+CJgUFIBxKxstM5jut25ZccIWAIp+1Sc/C/BmxZA== X-Received: by 2002:a05:6402:1649:: with SMTP id s9mr1266085edx.38.1644265637064; Mon, 07 Feb 2022 12:27:17 -0800 (PST) Received: from alco.lan (80.71.134.83.ipv4.parknet.dk. [80.71.134.83]) by smtp.gmail.com with ESMTPSA id t8sm787893eji.94.2022.02.07.12.27.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Feb 2022 12:27:16 -0800 (PST) From: Ricardo Ribalda To: kunit-dev@googlegroups.com, kasan-dev@googlegroups.com, linux-kselftest@vger.kernel.org, Brendan Higgins , Mika Westerberg Cc: Ricardo Ribalda Subject: [PATCH v2 2/6] kunit: use NULL macros Date: Mon, 7 Feb 2022 21:27:10 +0100 Message-Id: <20220207202714.1890024-2-ribalda@chromium.org> X-Mailer: git-send-email 2.35.0.263.gb82422642f-goog In-Reply-To: <20220207202714.1890024-1-ribalda@chromium.org> References: <20220207202714.1890024-1-ribalda@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org Replace the NULL checks with the more specific and idiomatic NULL macros. Signed-off-by: Ricardo Ribalda --- lib/kunit/kunit-example-test.c | 2 ++ lib/kunit/kunit-test.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/kunit/kunit-example-test.c b/lib/kunit/kunit-example-test.c index 4bbf37c04eba..91b1df7f59ed 100644 --- a/lib/kunit/kunit-example-test.c +++ b/lib/kunit/kunit-example-test.c @@ -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"); diff --git a/lib/kunit/kunit-test.c b/lib/kunit/kunit-test.c index 555601d17f79..8e2fe083a549 100644 --- a/lib/kunit/kunit-test.c +++ b/lib/kunit/kunit-test.c @@ -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 }