From 8e70c47c48d2563cf9c64e9f512668a834c45bf6 Mon Sep 17 00:00:00 2001 From: Karthikeyan Ramasubramanian Date: Thu, 3 May 2018 14:14:35 -0600 Subject: [PATCH] tty: serial: qcom_geni_serial: Use min3 to find minimum of 3 values Use min3 helper to calculate the minimum value of 3 variables. Signed-off-by: Karthikeyan Ramasubramanian Reviewed-by: Matthias Kaehlcke Reviewed-by: Stephen Boyd Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/qcom_geni_serial.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c index 9bf0ca7479c0..6c5492e92ce5 100644 --- a/drivers/tty/serial/qcom_geni_serial.c +++ b/drivers/tty/serial/qcom_geni_serial.c @@ -586,11 +586,7 @@ static void qcom_geni_serial_handle_tx(struct uart_port *uport) avail = (port->tx_fifo_depth - port->tx_wm) * port->tx_bytes_pw; tail = (xmit->tail + port->xmit_size) & (UART_XMIT_SIZE - 1); - if (chunk > (UART_XMIT_SIZE - tail)) - chunk = UART_XMIT_SIZE - tail; - if (chunk > avail) - chunk = avail; - + chunk = min3((size_t)chunk, (size_t)(UART_XMIT_SIZE - tail), avail); if (!chunk) goto out_write_wakeup; -- 2.20.1