dm: device: fail uclass_find_first_device() if list_empty
authorMarcel Ziswiler <marcel.ziswiler@toradex.com>
Fri, 1 Feb 2019 15:01:07 +0000 (16:01 +0100)
committerTom Rini <trini@konsulko.com>
Sat, 9 Feb 2019 12:51:00 +0000 (07:51 -0500)
commitf3885649657b4dfb669ae4505a0516c3affb8694
tree5505a39da34f193155977a5d907e4148ce627ea9
parenta765adc08f624dc229a83ac0c81f61af2d33246a
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>
drivers/core/uclass.c
test/dm/core.c