diff options
author | Patrice Chotard <patrice.chotard@st.com> | 2018-10-24 15:10:15 +0300 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2018-11-17 00:51:55 +0300 |
commit | f6abd5389ceab5fce185126c2364a324465fafbe (patch) | |
tree | 2b3387cdadc4dd9649b5f0b3785d5d945d8b2ca0 /drivers/core | |
parent | 8bbb5b20852aa81024eb7b2dcc3eb58275e83bb0 (diff) | |
download | u-boot-f6abd5389ceab5fce185126c2364a324465fafbe.tar.xz |
dm: uclass: Add uclass_next_device_err() to return a valid device
Similarly to uclass_first_device_err(), add uclass_next_device_err()
which returns an error if there are no next devices in that uclass.
Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/core')
-rw-r--r-- | drivers/core/uclass.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/core/uclass.c b/drivers/core/uclass.c index 6cfcde8918..d9c5719a87 100644 --- a/drivers/core/uclass.c +++ b/drivers/core/uclass.c @@ -562,6 +562,19 @@ int uclass_next_device(struct udevice **devp) return uclass_get_device_tail(dev, ret, devp); } +int uclass_next_device_err(struct udevice **devp) +{ + int ret; + + ret = uclass_next_device(devp); + if (ret) + return ret; + else if (!*devp) + return -ENODEV; + + return 0; +} + int uclass_first_device_check(enum uclass_id id, struct udevice **devp) { int ret; |