Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 96317e9e authored by Jiri Slaby's avatar Jiri Slaby Committed by Greg Kroah-Hartman
Browse files

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: default avatarJiri Slaby <jslaby@suse.cz>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 6798df4c
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
@@ -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,12 +3586,11 @@ 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;
	}

	if (retval)
			goto err;
		}
	}

	desc = csw->con_startup();
	if (!desc) {