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

Simon Glass sjg at chromium.org
Wed Jun 7 16:28:38 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: 161690)
Fixes: 43b4156 (dm: sandbox: pwm: Add a basic pwm test)
---

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

diff --git a/test/dm/pwm.c b/test/dm/pwm.c
index f1e38c77dd..6b2dedf6cc 100644
--- a/test/dm/pwm.c
+++ b/test/dm/pwm.c
@@ -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));
-- 
2.13.0.506.g27d5fe0cd-goog



More information about the U-Boot mailing list