[PATCH] tty: remove redundant condition checks

Xichao Zhao posted 1 patch 4 days, 7 hours ago
drivers/tty/hvc/hvc_console.c   | 2 +-
drivers/tty/serial/msm_serial.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
[PATCH] tty: remove redundant condition checks
Posted by Xichao Zhao 4 days, 7 hours ago
Remove redundant condition checks and replace else if with else.

Signed-off-by: Xichao Zhao <zhao.xichao@vivo.com>
---
 drivers/tty/hvc/hvc_console.c   | 2 +-
 drivers/tty/serial/msm_serial.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/hvc/hvc_console.c b/drivers/tty/hvc/hvc_console.c
index cd1f657f782d..fffc30b9ea54 100644
--- a/drivers/tty/hvc/hvc_console.c
+++ b/drivers/tty/hvc/hvc_console.c
@@ -184,7 +184,7 @@ static void hvc_console_print(struct console *co, const char *b,
 					hvc_console_flush(cons_ops[index],
 						      vtermnos[index]);
 				}
-			} else if (r > 0) {
+			} else {
 				i -= r;
 				if (i > 0)
 					memmove(c, c+r, i);
diff --git a/drivers/tty/serial/msm_serial.c b/drivers/tty/serial/msm_serial.c
index 3449945493ce..2e999cb9c974 100644
--- a/drivers/tty/serial/msm_serial.c
+++ b/drivers/tty/serial/msm_serial.c
@@ -1102,7 +1102,7 @@ msm_find_best_baud(struct uart_port *port, unsigned int baud,
 
 			if (result == baud)
 				break;
-		} else if (entry->divisor > divisor) {
+		} else {
 			old = target;
 			target = clk_round_rate(msm_port->clk, old + 1);
 			/*
-- 
2.34.1
Re: [PATCH] tty: remove redundant condition checks
Posted by Christophe Leroy 4 days, 6 hours ago

Le 05/09/2025 à 11:13, Xichao Zhao a écrit :
> Remove redundant condition checks and replace else if with else.
> 
> Signed-off-by: Xichao Zhao <zhao.xichao@vivo.com>

Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>

> ---
>   drivers/tty/hvc/hvc_console.c   | 2 +-
>   drivers/tty/serial/msm_serial.c | 2 +-
>   2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/tty/hvc/hvc_console.c b/drivers/tty/hvc/hvc_console.c
> index cd1f657f782d..fffc30b9ea54 100644
> --- a/drivers/tty/hvc/hvc_console.c
> +++ b/drivers/tty/hvc/hvc_console.c
> @@ -184,7 +184,7 @@ static void hvc_console_print(struct console *co, const char *b,
>   					hvc_console_flush(cons_ops[index],
>   						      vtermnos[index]);
>   				}
> -			} else if (r > 0) {
> +			} else {
>   				i -= r;
>   				if (i > 0)
>   					memmove(c, c+r, i);
> diff --git a/drivers/tty/serial/msm_serial.c b/drivers/tty/serial/msm_serial.c
> index 3449945493ce..2e999cb9c974 100644
> --- a/drivers/tty/serial/msm_serial.c
> +++ b/drivers/tty/serial/msm_serial.c
> @@ -1102,7 +1102,7 @@ msm_find_best_baud(struct uart_port *port, unsigned int baud,
>   
>   			if (result == baud)
>   				break;
> -		} else if (entry->divisor > divisor) {
> +		} else {
>   			old = target;
>   			target = clk_round_rate(msm_port->clk, old + 1);
>   			/*