diff options
author | Marcel Ziswiler <marcel.ziswiler@toradex.com> | 2019-02-01 18:01:07 +0300 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2019-02-09 15:51:00 +0300 |
commit | f3885649657b4dfb669ae4505a0516c3affb8694 (patch) | |
tree | 5505a39da34f193155977a5d907e4148ce627ea9 /drivers | |
parent | a765adc08f624dc229a83ac0c81f61af2d33246a (diff) | |
download | u-boot-f3885649657b4dfb669ae4505a0516c3affb8694.tar.xz |
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 'drivers')
-rw-r--r-- | drivers/core/uclass.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/core/uclass.c b/drivers/core/uclass.c index a622f07941..fc3157de39 100644 --- a/drivers/core/uclass.c +++ b/drivers/core/uclass.c @@ -225,7 +225,7 @@ int uclass_find_first_device(enum uclass_id id, struct udevice **devp) if (ret) return ret; if (list_empty(&uc->dev_head)) - return 0; + return -ENODEV; *devp = list_first_entry(&uc->dev_head, struct udevice, uclass_node); |