console-server: rework error path for realpath(../..) failure
We shouldn't hit this, as no tty paths will be directly under /sys. All
following code will require tty_device_tty_dir to be set, so use the
exit path without indicating an error.
Change-Id: I3a447d0fed6dda6372fed7a6c7879fad7f04f077
Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
diff --git a/console-server.c b/console-server.c
index 2965284..222f215 100644
--- a/console-server.c
+++ b/console-server.c
@@ -222,24 +222,25 @@
}
tty_sysfs_devnode = realpath(tty_device_reldir, NULL);
+ /* not really an error, but it'd be unusual if we cannot resolve
+ * two parent dirs...
+ */
if (!tty_sysfs_devnode) {
warn("Can't find parent device for %s", tty_kname_real);
+ rc = 0;
+ goto out_free;
}
/* Arbitrarily pick an attribute to differentiate UART vs VUART */
- if (tty_sysfs_devnode) {
- rc = asprintf(&tty_vuart_lpc_addr, "%s/lpc_address",
- tty_sysfs_devnode);
- if (rc < 0) {
- goto out_free;
- }
+ rc = asprintf(&tty_vuart_lpc_addr, "%s/lpc_address", tty_sysfs_devnode);
+ if (rc < 0) {
+ goto out_free;
+ }
- rc = access(tty_vuart_lpc_addr, F_OK);
- if (!rc) {
- server->tty.type = TTY_DEVICE_VUART;
- server->tty.vuart.sysfs_devnode =
- strdup(tty_sysfs_devnode);
- }
+ rc = access(tty_vuart_lpc_addr, F_OK);
+ if (!rc) {
+ server->tty.type = TTY_DEVICE_VUART;
+ server->tty.vuart.sysfs_devnode = strdup(tty_sysfs_devnode);
}
rc = 0;