Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Jiri Slaby and committed by
Greg Kroah-Hartman
96317e9e 6798df4c

+4 -5
+4 -5
drivers/tty/vt/vt.c
··· 3575 3575 struct module *owner = csw->owner; 3576 3576 struct con_driver *con_driver; 3577 3577 const char *desc; 3578 - int i, retval = 0; 3578 + int i, retval; 3579 3579 3580 3580 WARN_CONSOLE_UNLOCKED(); 3581 3581 ··· 3586 3586 con_driver = &registered_con_driver[i]; 3587 3587 3588 3588 /* already registered */ 3589 - if (con_driver->con == csw) 3589 + if (con_driver->con == csw) { 3590 3590 retval = -EBUSY; 3591 + goto err; 3592 + } 3591 3593 } 3592 - 3593 - if (retval) 3594 - goto err; 3595 3594 3596 3595 desc = csw->con_startup(); 3597 3596 if (!desc) {