diff --git a/drivers/serial/serial.c b/drivers/serial/serial.c index d648a73f41..3ab323bcb8 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)