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 <ma...@denx.de>
Cc: Marek Vasut <marek.va...@gmail.com>
Cc: Tom Rini <tr...@ti.com>
---
 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 <stdio_dev.h>
 #include <post.h>
 #include <linux/compiler.h>
+#include <errno.h>
 
 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;
 }
 
 void serial_reinit_all(void)
-- 
1.7.10.4

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to