[20/22] tty: vt: use switch+case in the ESgetpars case

Message ID 20240202065608.14019-21-jirislaby@kernel.org
State New
Headers
Series tty: vt: cleanup ESC sequences handling |

Commit Message

Jiri Slaby Feb. 2, 2024, 6:56 a.m. UTC
  To be uniform in the 'c' handling, use switch-case (with ranges) even in
the ESgetpars case in do_con_trol().

Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org>
---
 drivers/tty/vt/vt.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
  

Patch

diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
index b5fc3b896e26..b3c61ec92df9 100644
--- a/drivers/tty/vt/vt.c
+++ b/drivers/tty/vt/vt.c
@@ -2628,10 +2628,14 @@  static void do_con_trol(struct tty_struct *tty, struct vc_data *vc, u8 c)
 		vc->vc_priv = EPecma;
 		fallthrough;
 	case ESgetpars: /* ESC [ aka CSI, parameters expected */
-		if (c == ';' && vc->vc_npar < NPAR - 1) {
-			vc->vc_npar++;
-			return;
-		} else if (c>='0' && c<='9') {
+		switch (c) {
+		case ';':
+			if (vc->vc_npar < NPAR - 1) {
+				vc->vc_npar++;
+				return;
+			}
+			break;
+		case '0' ... '9':
 			vc->vc_par[vc->vc_npar] *= 10;
 			vc->vc_par[vc->vc_npar] += c - '0';
 			return;