All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Glass <sjg@chromium.org>
To: U-Boot Mailing List <u-boot@lists.denx.de>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>,
	Tom Rini <trini@konsulko.com>, Simon Glass <sjg@chromium.org>,
	Marek Vasut <marex@denx.de>,
	Pavel Herrmann <morpheus.ibis@gmail.com>
Subject: [PATCH 1/5] dm: rtc: Make use of ut_assertnonnull()
Date: Mon,  1 Aug 2022 07:58:44 -0600	[thread overview]
Message-ID: <20220801135848.992449-2-sjg@chromium.org> (raw)
In-Reply-To: <20220801135848.992449-1-sjg@chromium.org>

Use this (newish) macro since it is designed for the purpose of making
sure things are non-NULL.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 test/dm/rtc.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/test/dm/rtc.c b/test/dm/rtc.c
index c7f9f8f0ce7..a8349756c18 100644
--- a/test/dm/rtc.c
+++ b/test/dm/rtc.c
@@ -66,7 +66,7 @@ static int dm_test_rtc_set_get(struct unit_test_state *uts)
 	ut_assertok(dm_rtc_get(dev, &now));
 
 	ut_assertok(i2c_emul_find(dev, &emul));
-	ut_assert(emul != NULL);
+	ut_assertnonnull(emul);
 
 	/* Tell the RTC to go into manual mode */
 	old_offset = sandbox_i2c_rtc_set_offset(emul, false, 0);
@@ -161,7 +161,7 @@ static int dm_test_rtc_read_write(struct unit_test_state *uts)
 	ut_asserteq(memcmp(buf, "at", 3), 0);
 
 	ut_assertok(i2c_emul_find(dev, &emul));
-	ut_assert(emul != NULL);
+	ut_assertnonnull(emul);
 
 	old_offset = sandbox_i2c_rtc_set_offset(emul, false, 0);
 	ut_assertok(dm_rtc_get(dev, &time));
@@ -245,7 +245,7 @@ static int dm_test_rtc_reset(struct unit_test_state *uts)
 	ut_assertok(dm_rtc_get(dev, &now));
 
 	ut_assertok(i2c_emul_find(dev, &emul));
-	ut_assert(emul != NULL);
+	ut_assertnonnull(emul);
 
 	old_base_time = sandbox_i2c_rtc_get_set_base_time(emul, 0);
 
@@ -274,9 +274,9 @@ static int dm_test_rtc_dual(struct unit_test_state *uts)
 	ut_assertok(dm_rtc_get(dev2, &now2));
 
 	ut_assertok(i2c_emul_find(dev1, &emul1));
-	ut_assert(emul1 != NULL);
+	ut_assertnonnull(emul1);
 	ut_assertok(i2c_emul_find(dev2, &emul2));
-	ut_assert(emul2 != NULL);
+	ut_assertnonnull(emul2);
 
 	offset = sandbox_i2c_rtc_set_offset(emul1, false, -1);
 	sandbox_i2c_rtc_set_offset(emul2, false, offset + 1);
-- 
2.37.1.455.g008518b4e5-goog


  reply	other threads:[~2022-08-01 13:59 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-01 13:58 [PATCH 0/5] rtc: Work around race conditions Simon Glass
2022-08-01 13:58 ` Simon Glass [this message]
2022-09-03  1:55   ` [PATCH 1/5] dm: rtc: Make use of ut_assertnonnull() Tom Rini
2022-08-01 13:58 ` [PATCH 2/5] test: Allow running tests multiple times Simon Glass
2022-08-01 13:58 ` [PATCH 3/5] dm: rtc: Avoid a race in the rtc_reset test Simon Glass
2022-08-01 13:58 ` [PATCH 4/5] dm: rtc: Try to avoid a race in rtc_set_get test Simon Glass
2022-08-01 13:58 ` [PATCH 5/5] dm: rtc: Try to handle the localtime() race Simon Glass
2022-08-01 15:00   ` Heinrich Schuchardt
2022-08-01 19:13     ` Simon Glass

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220801135848.992449-2-sjg@chromium.org \
    --to=sjg@chromium.org \
    --cc=marex@denx.de \
    --cc=morpheus.ibis@gmail.com \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    --cc=xypron.glpk@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.