summaryrefslogtreecommitdiff
path: root/common/stdio.c
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2016-11-13 14:22:00 -0700
committerSimon Glass <sjg@chromium.org>2016-11-25 17:59:30 -0700
commitd844efec472d7ea16b229d1c2c854bed70082278 (patch)
treeaf8bbeb626fd38ba1479afec8f1a40ca742699cc /common/stdio.c
parentab29a34a598c2a78a43bcc68c0e097d814038f41 (diff)
stdio: Correct numbering logic in stdio_probe_device()
The current code assumes that the devices are ordered corresponding to their alias value. But (for example) video1 can come before video0 in the device tree. Correct this, by always looking for device 0 first. After that we can fall back to finding the first available device. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'common/stdio.c')
-rw-r--r--common/stdio.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/common/stdio.c b/common/stdio.c
index a7d016bb9d..4d30017530 100644
--- a/common/stdio.c
+++ b/common/stdio.c
@@ -151,9 +151,10 @@ static int stdio_probe_device(const char *name, enum uclass_id id,
*sdevp = NULL;
seq = trailing_strtoln(name, NULL);
if (seq == -1)
+ seq = 0;
+ ret = uclass_get_device_by_seq(id, seq, &dev);
+ if (ret == -ENODEV)
ret = uclass_first_device_err(id, &dev);
- else
- ret = uclass_get_device_by_seq(id, seq, &dev);
if (ret) {
debug("No %s device for seq %d (%s)\n", uclass_get_name(id),
seq, name);