Commit 6d93e25806337d46ee75c6703b3ecc972cb179a5

Authored by Marek Vasut
Committed by Tom Rini
1 parent ec3fd68952

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 <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>

Showing 1 changed file with 6 additions and 5 deletions Side-by-side Diff

drivers/serial/serial.c
... ... @@ -26,6 +26,7 @@
26 26 #include <stdio_dev.h>
27 27 #include <post.h>
28 28 #include <linux/compiler.h>
  29 +#include <errno.h>
29 30  
30 31 DECLARE_GLOBAL_DATA_PTR;
31 32  
32 33  
... ... @@ -205,13 +206,13 @@
205 206 struct serial_device *s;
206 207  
207 208 for (s = serial_devices; s; s = s->next) {
208   - if (strcmp(s->name, name) == 0) {
209   - serial_current = s;
210   - return 0;
211   - }
  209 + if (strcmp(s->name, name))
  210 + continue;
  211 + serial_current = s;
  212 + return 0;
212 213 }
213 214  
214   - return 1;
  215 + return -EINVAL;
215 216 }
216 217  
217 218 void serial_reinit_all(void)