dm: core: Correct the return value for uclass_find_first_device()

This function returns -ENODEV when there is no device. This is
inconsistent with other functions, such as uclass_find_next_device(),
which returns 0.

Update it and tidy up the incorrect '-1' values in the comments.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Tested-by: Bin Meng <bmeng.cn@gmail.com>
This commit is contained in:
Simon Glass
2019-09-25 08:55:55 -06:00
committed by Bin Meng
parent ea14778d06
commit 4805a7af8e
3 changed files with 4 additions and 5 deletions

View File

@@ -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 -ENODEV;
return 0;
*devp = list_first_entry(&uc->dev_head, struct udevice, uclass_node);