Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 2 Jun 2017 14:01:17 +0000 (UTC)
From:      Andrew Turner <andrew@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r319494 - head/sys/dev/uart
Message-ID:  <201706021401.v52E1H1k052657@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201706021401.v52E1H1k052657>