From mboxrd@z Thu Jan 1 00:00:00 1970 From: Allen Martin Date: Fri, 19 Oct 2012 17:45:54 -0700 Subject: [U-Boot] [PATCH 3/6] serial: Reorder serial_assign() In-Reply-To: <1349568426-27219-4-git-send-email-marex@denx.de> References: <1349568426-27219-1-git-send-email-marex@denx.de> <1349568426-27219-4-git-send-email-marex@denx.de> Message-ID: <20121020004554.GA25104@badger> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Sat, Oct 06, 2012 at 05:07:03PM -0700, Marek Vasut wrote: > Reorder serial_assign() function to get rid of the extra level of > indentation. Also, adjust the return value to be -EINVAL instead of > positive one to be more consistent. > > Signed-off-by: Marek Vasut > Cc: Marek Vasut > Cc: Tom Rini > --- > drivers/serial/serial.c | 11 ++++++----- > 1 file changed, 6 insertions(+), 5 deletions(-) > > diff --git a/drivers/serial/serial.c b/drivers/serial/serial.c > index da41cd5..1054494 100644 > --- a/drivers/serial/serial.c > +++ b/drivers/serial/serial.c > @@ -26,6 +26,7 @@ > #include > #include > #include > +#include > > DECLARE_GLOBAL_DATA_PTR; > > @@ -203,13 +204,13 @@ int serial_assign(const char *name) > struct serial_device *s; > > for (s = serial_devices; s; s = s->next) { > - if (strcmp(s->name, name) == 0) { > - serial_current = s; > - return 0; > - } > + if (strcmp(s->name, name)) > + continue; > + serial_current = s; > + return 0; > } > > - return 1; > + return -EINVAL; Hi Marek, the change to return value here broke serial output on tegra. What I see is that the serial device name (s->name) is "eserial0" as set by serial_ns16550.c, and the name passed in from the stdout environment is "serial" so they don't match and it fails. This always used to be ok because the return code didn't indicate failure and iomux_doenv() would continue on happily, but now it causes iomux_doenv() to fail and no printfs() work after that. Not sure what the right fix is, should stdout really be set to "eserial0"? It seems "serial" should mean "the default serial device" which for the normal case is the one and only device. -Allen -- nvpublic