diff mbox series

[1/5] dm: rtc: Make use of ut_assertnonnull()

Message ID 20220801135848.992449-2-sjg@chromium.org
State Accepted
Commit e033c180d0327e8fa791660ae26cdebd5e400153
Delegated to: Tom Rini
Headers show
Series rtc: Work around race conditions | expand

Commit Message

Simon Glass Aug. 1, 2022, 1:58 p.m. UTC
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(-)

Comments

Tom Rini Sept. 3, 2022, 1:55 a.m. UTC | #1
On Mon, Aug 01, 2022 at 07:58:44AM -0600, Simon Glass wrote:

> 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>

For the series, applied to u-boot/next, thanks!
diff mbox series

Patch

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);