提交 dee19416 编写于 作者: M Marek Vasut 提交者: Tom Rini

serial: Reorder get_current()

Reorder the get_current() function to make it a bit more readable.
The code does not grow and there is minor change in the code logic,
where dev != NULL is now checked in any case.
Signed-off-by: NMarek Vasut <marex@denx.de>
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Tom Rini <trini@ti.com>
上级 6d93e258
......@@ -227,20 +227,23 @@ static struct serial_device *get_current(void)
{
struct serial_device *dev;
if (!(gd->flags & GD_FLG_RELOC) || !serial_current) {
if (!(gd->flags & GD_FLG_RELOC))
dev = default_serial_console();
else if (!serial_current)
dev = default_serial_console();
else
dev = serial_current;
/* We must have a console device */
if (!dev) {
/* We must have a console device */
if (!dev) {
#ifdef CONFIG_SPL_BUILD
puts("Cannot find console\n");
hang();
puts("Cannot find console\n");
hang();
#else
panic("Cannot find console\n");
panic("Cannot find console\n");
#endif
}
} else
dev = serial_current;
}
return dev;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册