diff --git a/drivers/core/uclass.c b/drivers/core/uclass.c index aba98801fd4505b269f3aecf6ac454c3f21bff86..ffe69956d591c058e3a4410f5a1bbee71a63eec0 100644 --- a/drivers/core/uclass.c +++ b/drivers/core/uclass.c @@ -153,6 +153,8 @@ int uclass_find_device(enum uclass_id id, int index, struct udevice **devp) ret = uclass_get(id, &uc); if (ret) return ret; + if (list_empty(&uc->dev_head)) + return -ENODEV; list_for_each_entry(dev, &uc->dev_head, uclass_node) { if (!index--) {