aboutsummaryrefslogtreecommitdiff
path: root/test/dm
diff options
context:
space:
mode:
authorMarcel Ziswiler <marcel.ziswiler@toradex.com>2019-02-01 16:01:07 +0100
committerTom Rini <trini@konsulko.com>2019-02-09 07:51:00 -0500
commitf3885649657b4dfb669ae4505a0516c3affb8694 (patch)
tree5505a39da34f193155977a5d907e4148ce627ea9 /test/dm
parenta765adc08f624dc229a83ac0c81f61af2d33246a (diff)
downloadu-boot-f3885649657b4dfb669ae4505a0516c3affb8694.zip
u-boot-f3885649657b4dfb669ae4505a0516c3affb8694.tar.gz
u-boot-f3885649657b4dfb669ae4505a0516c3affb8694.tar.bz2
dm: device: fail uclass_find_first_device() if list_empty
While uclass_find_device() fails with -ENODEV in case of list_empty strangely uclass_find_first_device() returns 0. Fix uclass_find_first_device() to also fail with -ENODEV instead. Signed-off-by: Marcel Ziswiler <marcel.ziswiler@toradex.com> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'test/dm')
-rw-r--r--test/dm/core.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/test/dm/core.c b/test/dm/core.c
index 260f649..edd55b0 100644
--- a/test/dm/core.c
+++ b/test/dm/core.c
@@ -749,6 +749,10 @@ static int dm_test_uclass_devices_find(struct unit_test_state *uts)
ut_assert(dev);
}
+ ret = uclass_find_first_device(UCLASS_TEST_DUMMY, &dev);
+ ut_assert(ret == -ENODEV);
+ ut_assert(!dev);
+
return 0;
}
DM_TEST(dm_test_uclass_devices_find, DM_TESTF_SCAN_PDATA);