From: Marek Vasut Date: Sat, 6 Oct 2012 14:07:03 +0000 (+0000) Subject: serial: Reorder serial_assign() X-Git-Tag: v2013.01-rc1~167 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6d93e25806337d46ee75c6703b3ecc972cb179a5;p=kernel%2Fu-boot.git serial: Reorder serial_assign() 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 --- diff --git a/drivers/serial/serial.c b/drivers/serial/serial.c index d648a73..3ab323b 100644 --- a/drivers/serial/serial.c +++ b/drivers/serial/serial.c @@ -26,6 +26,7 @@ #include #include #include +#include DECLARE_GLOBAL_DATA_PTR; @@ -205,13 +206,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; } void serial_reinit_all(void)