dm: serial-uclass: Move a carriage return before a line feed
In general, a carriage return needs to execute before a line feed. The
patch is to change serial DM driver serial-uclass.c based on this rule.
Signed-off-by: Alison Wang <alison.wang@nxp.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
diff --git a/drivers/serial/serial-uclass.c b/drivers/serial/serial-uclass.c
index 1c447ff..f154eb1 100644
--- a/drivers/serial/serial-uclass.c
+++ b/drivers/serial/serial-uclass.c
@@ -123,11 +123,12 @@
struct dm_serial_ops *ops = serial_get_ops(dev);
int err;
+ if (ch == '\n')
+ _serial_putc(dev, '\r');
+
do {
err = ops->putc(dev, ch);
} while (err == -EAGAIN);
- if (ch == '\n')
- _serial_putc(dev, '\r');
}
static void _serial_puts(struct udevice *dev, const char *str)