提交 a17fa121 编写于 作者: S Shubhrajyoti Datta 提交者: Greg Kroah-Hartman

tty: xilinx_uartps: Add timeout waiting for loop

There is a potential infinite loop while waiting for the
the TXFULL to deassert. Adds the error message and timeout to
avoid infinite loop if it fails to get the TX fifo not full.
Signed-off-by: NShubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
Link: https://lore.kernel.org/r/20220729114748.18332-7-shubhrajyoti.datta@xilinx.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 b3696289
...@@ -1147,8 +1147,20 @@ static void cdns_uart_console_putchar(struct uart_port *port, unsigned char ch) ...@@ -1147,8 +1147,20 @@ static void cdns_uart_console_putchar(struct uart_port *port, unsigned char ch)
} }
cpu_relax(); cpu_relax();
} }
while (readl(port->membase + CDNS_UART_SR) & CDNS_UART_SR_TXFULL)
timeout = jiffies + msecs_to_jiffies(1000);
while (1) {
ctrl_reg = readl(port->membase + CDNS_UART_SR);
if (!(ctrl_reg & CDNS_UART_SR_TXFULL))
break;
if (time_after(jiffies, timeout)) {
dev_warn(port->dev,
"timeout waiting for TX fifo\n");
return;
}
cpu_relax(); cpu_relax();
}
writel(ch, port->membase + CDNS_UART_FIFO); writel(ch, port->membase + CDNS_UART_FIFO);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册