tty: xuartps: Cleanup: Reformat if-else
Convert an if-else into the more common early return on error, reducing the indent level of the happy path. Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
373e882f9e
commit
354fb1a7d7
|
@ -202,9 +202,9 @@ static void cdns_uart_handle_rx(struct uart_port *port, unsigned int isrstatus)
|
|||
isrstatus &= port->read_status_mask;
|
||||
isrstatus &= ~port->ignore_status_mask;
|
||||
|
||||
if ((isrstatus & CDNS_UART_IXR_TOUT) ||
|
||||
(isrstatus & CDNS_UART_IXR_RXTRIG)) {
|
||||
/* Receive Timeout Interrupt */
|
||||
if (!(isrstatus & (CDNS_UART_IXR_TOUT | CDNS_UART_IXR_RXTRIG)))
|
||||
return;
|
||||
|
||||
while (!(readl(port->membase + CDNS_UART_SR_OFFSET) &
|
||||
CDNS_UART_SR_RXEMPTY)) {
|
||||
u32 data;
|
||||
|
@ -213,8 +213,7 @@ static void cdns_uart_handle_rx(struct uart_port *port, unsigned int isrstatus)
|
|||
data = readl(port->membase + CDNS_UART_FIFO_OFFSET);
|
||||
|
||||
/* Non-NULL byte after BREAK is garbage (99%) */
|
||||
if (data && (port->read_status_mask &
|
||||
CDNS_UART_IXR_BRK)) {
|
||||
if (data && (port->read_status_mask & CDNS_UART_IXR_BRK)) {
|
||||
port->read_status_mask &= ~CDNS_UART_IXR_BRK;
|
||||
port->icount.brk++;
|
||||
if (uart_handle_break(port))
|
||||
|
@ -228,8 +227,7 @@ static void cdns_uart_handle_rx(struct uart_port *port, unsigned int isrstatus)
|
|||
*/
|
||||
if (port->sysrq) {
|
||||
spin_unlock(&port->lock);
|
||||
if (uart_handle_sysrq_char(port,
|
||||
(unsigned char)data)) {
|
||||
if (uart_handle_sysrq_char(port, data)) {
|
||||
spin_lock(&port->lock);
|
||||
continue;
|
||||
}
|
||||
|
@ -254,7 +252,6 @@ static void cdns_uart_handle_rx(struct uart_port *port, unsigned int isrstatus)
|
|||
}
|
||||
tty_flip_buffer_push(&port->state->port);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* cdns_uart_isr - Interrupt handler
|
||||
|
@ -1429,8 +1426,10 @@ static int cdns_uart_probe(struct platform_device *pdev)
|
|||
dev_err(&pdev->dev, "Cannot get uart_port structure\n");
|
||||
rc = -ENODEV;
|
||||
goto err_out_notif_unreg;
|
||||
} else {
|
||||
/* Register the port.
|
||||
}
|
||||
|
||||
/*
|
||||
* Register the port.
|
||||
* This function also registers this device with the tty layer
|
||||
* and triggers invocation of the config_port() entry point.
|
||||
*/
|
||||
|
@ -1441,14 +1440,15 @@ static int cdns_uart_probe(struct platform_device *pdev)
|
|||
port->private_data = cdns_uart_data;
|
||||
cdns_uart_data->port = port;
|
||||
platform_set_drvdata(pdev, port);
|
||||
|
||||
rc = uart_add_one_port(&cdns_uart_uart_driver, port);
|
||||
if (rc) {
|
||||
dev_err(&pdev->dev,
|
||||
"uart_add_one_port() failed; err=%i\n", rc);
|
||||
goto err_out_notif_unreg;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
err_out_notif_unreg:
|
||||
#ifdef CONFIG_COMMON_CLK
|
||||
|
|
Loading…
Reference in New Issue