From: Tom Rix Date: Sat, 11 Feb 2023 15:45:50 +0000 (-0800) Subject: serial: imx: remove a redundant check X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=3f92730eed57f8057e1e120a0a2e8ad04ba155d4;p=linux.git serial: imx: remove a redundant check cpp_check reports drivers/tty/serial/imx.c:1207:15: style: Condition 'r_bytes>0' is always true [knownConditionTrueFalse] if (r_bytes > 0) { r_byte is set to r_bytes = rx_ring->head - rx_ring->tail; The head - tail calculation is also done by the earlier check if (rx_ring->head <= sg_dma_len(sgl) && rx_ring->head > rx_ring->tail) { so r_bytes will always be > 0, so the second check is not needed. Signed-off-by: Tom Rix Reviewed-by: Iuliana Prodan Link: https://lore.kernel.org/r/20230211154550.2130670-1-trix@redhat.com Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index 363c77a140f0f..523f296d5747d 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c @@ -1204,11 +1204,9 @@ static void imx_uart_dma_rx_callback(void *data) r_bytes = rx_ring->head - rx_ring->tail; /* If we received something, check for 0xff flood */ - if (r_bytes > 0) { - spin_lock(&sport->port.lock); - imx_uart_check_flood(sport, imx_uart_readl(sport, USR2)); - spin_unlock(&sport->port.lock); - } + spin_lock(&sport->port.lock); + imx_uart_check_flood(sport, imx_uart_readl(sport, USR2)); + spin_unlock(&sport->port.lock); if (!(sport->port.ignore_status_mask & URXD_DUMMY_READ)) {