Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1393492

[PATCH 2/2] tty: vt, finish looping on duplicate

From Jiri Slaby <jslaby@suse.cz>
Newsgroups linux.kernel
Subject [PATCH 2/2] tty: vt, finish looping on duplicate
Date 2016-05-03 17:10 +0200
Message-ID <ruK7x-1Tc-49@gated-at.bofh.it> (permalink)
References <ruK7x-1Tc-45@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


When the console is already registered, stop crawling the
registered_con_driver array and return an error immediatelly.

This makes the code more obvious. And we do not need to initialize
retval anymore.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/tty/vt/vt.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
index 3ed1ae211acc..dc125322f48f 100644
--- a/drivers/tty/vt/vt.c
+++ b/drivers/tty/vt/vt.c
@@ -3575,7 +3575,7 @@ static int do_register_con_driver(const struct consw *csw, int first, int last)
 	struct module *owner = csw->owner;
 	struct con_driver *con_driver;
 	const char *desc;
-	int i, retval = 0;
+	int i, retval;
 
 	WARN_CONSOLE_UNLOCKED();
 
@@ -3586,13 +3586,12 @@ static int do_register_con_driver(const struct consw *csw, int first, int last)
 		con_driver = &registered_con_driver[i];
 
 		/* already registered */
-		if (con_driver->con == csw)
+		if (con_driver->con == csw) {
 			retval = -EBUSY;
+			goto err;
+		}
 	}
 
-	if (retval)
-		goto err;
-
 	desc = csw->con_startup();
 	if (!desc) {
 		retval = -ENODEV;
-- 
2.8.2

Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

[PATCH 1/2] tty: vt, return error when con_startup fails Jiri Slaby <jslaby@suse.cz> - 2016-05-03 17:10 +0200
  [PATCH 2/2] tty: vt, finish looping on duplicate Jiri Slaby <jslaby@suse.cz> - 2016-05-03 17:10 +0200

csiph-web