projects
/
oweals
/
u-boot.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
3834f41
)
dm: core: Check for empty list in uclass_find_device()
author
Simon Glass
<sjg@chromium.org>
Fri, 31 Jul 2015 15:31:19 +0000
(09:31 -0600)
committer
Simon Glass
<sjg@chromium.org>
Wed, 5 Aug 2015 14:42:40 +0000
(08:42 -0600)
This function needs to check the list has entries before traversing it.
Fix this bug.
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
drivers/core/uclass.c
patch
|
blob
|
history
diff --git
a/drivers/core/uclass.c
b/drivers/core/uclass.c
index aba98801fd4505b269f3aecf6ac454c3f21bff86..ffe69956d591c058e3a4410f5a1bbee71a63eec0 100644
(file)
--- 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--) {