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

Commit 32ad3a77 authored by Jiri Slaby's avatar Jiri Slaby Committed by Greg Kroah-Hartman
Browse files

TTY: serial_core, remove invalid test



tty->index (named here as line) is set up in initialize_tty_struct.
The value is checked in get_tty_driver for the found driver as:
	if (device < base || device >= base + p->num)
		continue;
	*index = device - base;

So index/line can never be more than driver->num. Hence remove this
test from uart_open.

Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
Cc: Alan Cox <alan@linux.intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 0ad7c9af
Loading
Loading
Loading
Loading
+0 −9
Original line number Original line Diff line number Diff line
@@ -1529,15 +1529,6 @@ static int uart_open(struct tty_struct *tty, struct file *filp)
	BUG_ON(!tty_locked());
	BUG_ON(!tty_locked());
	pr_debug("uart_open(%d) called\n", line);
	pr_debug("uart_open(%d) called\n", line);


	/*
	 * tty->driver->num won't change, so we won't fail here with
	 * tty->driver_data set to something non-NULL (and therefore
	 * we won't get caught by uart_close()).
	 */
	retval = -ENODEV;
	if (line >= tty->driver->num)
		goto fail;

	/*
	/*
	 * We take the semaphore inside uart_get to guarantee that we won't
	 * We take the semaphore inside uart_get to guarantee that we won't
	 * be re-entered while allocating the state structure, or while we
	 * be re-entered while allocating the state structure, or while we