]> git.sur5r.net Git - u-boot/commitdiff
test: wdt: Add a check that dev is not NULL
authorSimon Glass <sjg@chromium.org>
Wed, 7 Jun 2017 16:28:43 +0000 (10:28 -0600)
committerTom Rini <trini@konsulko.com>
Mon, 12 Jun 2017 12:38:09 +0000 (08:38 -0400)
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@chromium.org>
Reported-by: Coverity (CID: 163247)
Fixes: 0753bc2 (dm: Simple Watchdog uclass)
test/dm/wdt.c

index 2ecfceaaff99e9ab39e4da6138a8901914449bac..01165022c192bf62d1f7e6bab54d9599a8d37375 100644 (file)
@@ -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);