Author: andrew
Date: Fri Jun  2 14:01:17 2017
New Revision: 319494
URL: https://svnweb.freebsd.org/changeset/base/319494

Log:
  Fix device lookup of for the stdout-path chosen property.
  
  The stdout-path chosen property may include the serial connection details,
  e.g. the baud rate. When passing the device to OF_finddevice we need to
  strip off this information as it will cause the lookup to fail.
  
  Reviewed by:  emaste, manu
  Differential Revision:        https://reviews.freebsd.org/D6846

Modified:
  head/sys/dev/uart/uart_bus_fdt.c

Modified: head/sys/dev/uart/uart_bus_fdt.c
==============================================================================
--- head/sys/dev/uart/uart_bus_fdt.c    Fri Jun  2 13:33:50 2017        
(r319493)
+++ head/sys/dev/uart/uart_bus_fdt.c    Fri Jun  2 14:01:17 2017        
(r319494)
@@ -117,9 +117,18 @@ static int
 phandle_chosen_propdev(phandle_t chosen, const char *name, phandle_t *node)
 {
        char buf[64];
+       char *sep;
 
        if (OF_getprop(chosen, name, buf, sizeof(buf)) <= 0)
                return (ENXIO);
+       /*
+        * stdout-path may have a ':' to separate the device from the
+        * connection settings. Split the string so we just pass the former
+        * to OF_finddevice.
+        */
+       sep = strchr(buf, ':');
+       if (sep != NULL)
+               *sep = '\0';
        if ((*node = OF_finddevice(buf)) == -1)
                return (ENXIO);
 
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "[email protected]"

Reply via email to