TTY: remove unneeded tty->index checks

Checking if tty->index is in bounds is not needed. The tty has the
index set in the initial open. This is done in get_tty_driver. And it
can be only in interval <0,driver->num).

So remove the tests which check exactly this interval. Some are
left untouched as they check against the current backing device count.
(Leaving apart that the check is racy in most of the cases.)

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Jiri Slaby
2012-03-05 14:52:01 +01:00
committed by Greg Kroah-Hartman
parent 44a1bfd95d
commit 410235fd4d
21 changed files with 38 additions and 95 deletions

View File

@@ -725,9 +725,6 @@ static int gs_open(struct tty_struct *tty, struct file *file)
struct gs_port *port;
int status;
if (port_num < 0 || port_num >= n_ports)
return -ENXIO;
do {
mutex_lock(&ports[port_num].lock);
port = ports[port_num].port;