aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty/vt
diff options
context:
space:
mode:
authorJiri Slaby <jslaby@suse.cz>2016-05-03 11:05:55 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-05-03 18:59:15 -0400
commit96317e9e2a12d01eaaebf6b1e92b0f96c121e20a (patch)
tree1b8c7664675f7c4e5430932597f841c9f7e9ead3 /drivers/tty/vt
parent6798df4c5fe0a7e6d2065cf79649a794e5ba7114 (diff)
tty: vt, finish looping on duplicate
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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/vt')
-rw-r--r--drivers/tty/vt/vt.c9
1 files 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)
3575 struct module *owner = csw->owner; 3575 struct module *owner = csw->owner;
3576 struct con_driver *con_driver; 3576 struct con_driver *con_driver;
3577 const char *desc; 3577 const char *desc;
3578 int i, retval = 0; 3578 int i, retval;
3579 3579
3580 WARN_CONSOLE_UNLOCKED(); 3580 WARN_CONSOLE_UNLOCKED();
3581 3581
@@ -3586,13 +3586,12 @@ static int do_register_con_driver(const struct consw *csw, int first, int last)
3586 con_driver = &registered_con_driver[i]; 3586 con_driver = &registered_con_driver[i];
3587 3587
3588 /* already registered */ 3588 /* already registered */
3589 if (con_driver->con == csw) 3589 if (con_driver->con == csw) {
3590 retval = -EBUSY; 3590 retval = -EBUSY;
3591 goto err;
3592 }
3591 } 3593 }
3592 3594
3593 if (retval)
3594 goto err;
3595
3596 desc = csw->con_startup(); 3595 desc = csw->con_startup();
3597 if (!desc) { 3596 if (!desc) {
3598 retval = -ENODEV; 3597 retval = -ENODEV;