]> git.sur5r.net Git - u-boot/commitdiff
test: pwm: Add a check that dev is not NULL
authorSimon Glass <sjg@chromium.org>
Wed, 7 Jun 2017 16:28:38 +0000 (10:28 -0600)
committerTom Rini <trini@konsulko.com>
Mon, 12 Jun 2017 12:38:06 +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: 161690)
Fixes: 43b4156 (dm: sandbox: pwm: Add a basic pwm test)
test/dm/pwm.c

index f1e38c77dd680d507fcc07639fe2a7b61a719b63..6b2dedf6ccd6ba3c18f632a57ed245bd37b43785 100644 (file)
@@ -18,6 +18,7 @@ static int dm_test_pwm_base(struct unit_test_state *uts)
        struct udevice *dev;
 
        ut_assertok(uclass_get_device(UCLASS_PWM, 0, &dev));
+       ut_assertnonnull(dev);
        ut_assertok(pwm_set_config(dev, 0, 100, 50));
        ut_assertok(pwm_set_enable(dev, 0, true));
        ut_assertok(pwm_set_enable(dev, 1, true));