console-server: separate search for vuart node from tty setup
Move the code that sets up the tty to before the search for uart type.
Change-Id: Id08bfddd4e7710ba32f41aa10f4ce684b516a232
Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
diff --git a/console-server.c b/console-server.c
index 60d2d2e..2965284 100644
--- a/console-server.c
+++ b/console-server.c
@@ -208,6 +208,14 @@
goto out_free;
}
+ rc = asprintf(&server->tty.dev, "/dev/%s", tty_kname_real);
+ if (rc < 0) {
+ goto out_free;
+ }
+
+ // Default to non-VUART
+ server->tty.type = TTY_DEVICE_UART;
+
rc = asprintf(&tty_device_reldir, "%s/../../", tty_device_tty_dir);
if (rc < 0) {
goto out_free;
@@ -218,14 +226,6 @@
warn("Can't find parent device for %s", tty_kname_real);
}
- rc = asprintf(&server->tty.dev, "/dev/%s", tty_kname_real);
- if (rc < 0) {
- goto out_free;
- }
-
- // Default to non-VUART
- server->tty.type = TTY_DEVICE_UART;
-
/* Arbitrarily pick an attribute to differentiate UART vs VUART */
if (tty_sysfs_devnode) {
rc = asprintf(&tty_vuart_lpc_addr, "%s/lpc_address",