[U-Boot] [PATCH 06/10] test: wdt: Add a check that dev is not NULL

Simon Glass sjg at chromium.org
Wed Jun 7 16:28:43 UTC 2017


We know that uclass_get_device() does not return NULL for dev when it
succeeds but coverity does not. Add an extra check to hopefully keep it
happy.

Signed-off-by: Simon Glass <sjg at chromium.org>
Reported-by: Coverity (CID: 163247)
Fixes: 0753bc2 (dm: Simple Watchdog uclass)
---

 test/dm/wdt.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/test/dm/wdt.c b/test/dm/wdt.c
index 2ecfceaaff..01165022c1 100644
--- a/test/dm/wdt.c
+++ b/test/dm/wdt.c
@@ -20,6 +20,7 @@ static int dm_test_wdt_base(struct unit_test_state *uts)
 	const u64 timeout = 42;
 
 	ut_assertok(uclass_get_device(UCLASS_WDT, 0, &dev));
+	ut_assertnonnull(dev);
 	ut_asserteq(0, state->wdt.counter);
 	ut_asserteq(false, state->wdt.running);
 
-- 
2.13.0.506.g27d5fe0cd-goog



More information about the U-Boot mailing list