mirror of
https://github.com/u-boot/u-boot.git
synced 2025-05-08 19:11:53 +00:00
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>
This commit is contained in:
parent
8bbb5b2085
commit
f6abd5389c
2 changed files with 25 additions and 0 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue